Skip to content

Qt for Python

For discussion and questions about Qt for Python (PySide & Shiboken)

3.3k Topics 14.4k Posts
QtWS25 Last Chance
  • Hiding viewer panel vs window maximization

    Moved Unsolved 5 days ago
    0 Votes
    2 Posts
    43 Views
    When the state of self.was_maximized changed, the second if in adapt_viewer_panel is not working as expected. Adding self.was_maximized = not hide_viewer_panel to the else statement worked for me: def adapt_viewer_panel(self): if hide_viewer_panel: self.setFixedWidth(200) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred) self.viewer_panel.hide() else: self.setMinimumWidth(1500) self.setMaximumWidth(16777215) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) self.viewer_panel.show() self.was_maximized = not hide_viewer_panel self.updateGeometry() self.adjustSize() self.repaint() if not hide_viewer_panel and self.was_maximized: self.showMaximized()
  • hiding a QLabel at default

    Unsolved 2 days ago
    0 Votes
    2 Posts
    57 Views
    Hi and welcome to devnet, How are you setting up your label ? On a side note, I would recommend you take the time to re-evaluate your architecture. Your chain of dialogs is currently pretty brittle. There are other ways to switch from one widget to another that does not involve creating a new widget every time. Check for example QStackedWidget. You might want to also consider QMainWindow which provides a status bar. Depending on the error you might want to consider a QMessageBox using the appropriate level of urgency to show the message.
  • This topic is deleted!

    Unsolved 3 days ago
    0 Votes
    1 Posts
    11 Views
    No one has replied
  • 0 Votes
    2 Posts
    61 Views
    I solved the problem by using qtbase 6.9 instead of 6.10. However there might be other subtle reasons that I overlooked(?).
  • Could not update timestamps for skipped samples.

    Unsolved 28 days ago
    0 Votes
    7 Posts
    310 Views
    @SGaist I get it, thx, I will try.
  • 0 Votes
    1 Posts
    86 Views
    No one has replied
  • 0 Votes
    3 Posts
    103 Views
    Sorry, I misread your needs, if it is not the table but other widgets expanding, I suggest that you wrap the other widgets in a subclassed QWidget with fixed vertical sizeHint and fixed vertical sizePolicy like above. Or try setting other widgets' sizePolicy to Preferred, if they were Expanding. I will take a more thorough look later. In my experience, it is hard to control sizes like this by only using layout methods, even with Qt Designer. If you stumble on this, do not spend too much time.
  • 0 Votes
    2 Posts
    84 Views
    I decided to go ahead and submit an issue because I feel like it is likely a bug.
  • This topic is deleted!

    Unsolved 7 days ago
    0 Votes
    1 Posts
    17 Views
    No one has replied
  • Is building for iOS supported?

    Unsolved 8 days ago
    0 Votes
    4 Posts
    96 Views
    @patrickkidd As far as I know, Qt R&D is looking into it, but there is still lots of work to be done before iOS deployment is possible.
  • How to change the background color of a DockLabel instance??

    Unsolved 8 days ago
    0 Votes
    4 Posts
    133 Views
    @JonB ignore what i said in that line because i can't do this, if you just copy and run the script above, you will notice how it doesn't work and the color does not change to blue, hence the problem
  • Qml Webcam Integration

    Unsolved 8 days ago
    0 Votes
    1 Posts
    34 Views
    No one has replied
  • 0 Votes
    5 Posts
    150 Views
    @SGaist Thanks for the suggestion! I’ll definitely try using commitDataRequest(). Just to clarify — will this method reliably block or cancel GUI-initiated shutdowns (like using the power-off button from GNOME or KDE) if I call manager.cancel() inside that slot? Also, does this approach still work reliably with modern session managers, given that some DEs (like GNOME) are moving away from traditional X11 session management? Are there any best practices for using commitDataRequest() together with D-Bus inhibitors or org.freedesktop.login1 to improve compatibility across desktop environments? Thanks again — I appreciate your insights!
  • PyQt6 minimal requirements for Ubuntu github workflow

    Solved 12 days ago
    0 Votes
    6 Posts
    264 Views
    Glad you found out and thanks for sharing ! I did not think about this library because most of the time it happens when building C++ projects without all dependencies properly installed.
  • Defer Resize Event due to expensive resize method.

    Unsolved 13 days ago
    0 Votes
    3 Posts
    87 Views
    @AliSot2000 said in Defer Resize Event due to expensive resize method.: Is there a way to detect if the LMB is pressed during a ResizeEvent? Because it doesn't seem to be the case. Most likely resizing a (top-level) window is done by the underlying OS/window manager and thus Qt does not know anything about the mouse. This is why you only a resize event, but no mouse event. (At least, that is my guess.) There is a common trick using two timers, though the second timer is usually used to not delay the function call indefinitely (which you don't seem to need in your case). So, using a single timer is okay. However, you need to make sure that you reuse the same timer and reset it, so that the timeout is further delayed until there no more interactions.
  • Unable to change the background color of DockLabel

    Unsolved 13 days ago
    0 Votes
    4 Posts
    94 Views
    sorry i messed up the code in the first reply, i'm new here haha from PyQt5.QtWidgets import QApplication, QMainWindow from pyqtgraph.dockarea import Dock, DockArea import pyqtgraph as pg import sys class DockApp(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("Dockable Display App") self.setGeometry(100, 100, 800, 600) self.area = DockArea() self.setCentralWidget(self.area) self.set_dock_default() def set_dock_default(self): """Sets up the dock with a display window.""" self.image_dock = Dock(name="Display Dock", size=(1, 1)) self.image_dock.label.setStyleSheet("background-color: #04B2E2;") #change to blu but doesn't work self.display_window = pg.PlotWidget(title="Image Display") self.display_window.getViewBox().invertY(True) # Inverting Y axis self.image_dock.addWidget(self.display_window) self.area.addDock(self.image_dock, "top") if __name__ == "__main__": app = QApplication(sys.argv) window = DockApp() window.show() sys.exit(app.exec_())
  • Help resolving PySide6 install issues on Rocky Linux 8

    Unsolved 15 days ago
    0 Votes
    13 Posts
    329 Views
    @CristianMaureira Thank you, this is exactly what I was looking for. I have no idea how I didn't find it while googling.
  • Exchanging data between a PyQt5 app asynchronously

    Unsolved 14 days ago
    0 Votes
    5 Posts
    170 Views
    Thank you once again! I will dig into those examples.
  • simplest mvc pattern in pyside6

    Unsolved 25 days ago
    0 Votes
    3 Posts
    247 Views
    In case you need some guidance, here is an auto-translate (C++ -> Python) for the snippet within that page https://doc.qt.io/qtforpython-6/overviews/qtwidgets-model-view-programming.html (some of the code might not be 100% working but it might be hopefully a starting point)
  • 0 Votes
    4 Posts
    263 Views
    Hey @dev-anis what you are trying to achieve is completely possible in PyQt6 (bindings by Riverbank Computng), but I'm not familiar how. That being said, within PySide6 (official bindings by The Qt Company) we have a tutorial for creating a SQL Alchemy PySide6 application https://doc.qt.io/qtforpython-6/tutorials/finance_manager/index.html#tutorial-financemanager where you can create a package with the deployment tool