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
  • Is building for iOS supported?

    Unsolved 25 days ago
    0 Votes
    7 Posts
    163 Views
    Ah ok, thanks for the ticket. Watched and voted. So it looks like it is a question of priority and bandwidth. I have not played with pyside6-deploy for the other platforms yet. I suppose that would be the place to start before looking for the problems arising from applying the same technique to iOS. Is there a published development plan where this falls for the Qt Company's internal developer resources?
  • Generating PY from QRC Everytime a Resource file changes

    Unsolved 27 Nov 2020, 17:28
    0 Votes
    4 Posts
    318 Views
    I made a batch script that I run every time I detect that the .qrc (or .ui) files have changed. It's all automated before launching the application.
  • PySide6 QLineSeries doesn't plot correctly

    Unsolved 15 days ago
    0 Votes
    3 Posts
    83 Views
    @JonB said in PySide6 QLineSeries doesn't plot correctly: this should not be a PySide6/Python issue Yes, https://bugreports.qt.io/browse/PYSIDE-3083 For it seems not so robust, I tries PythonQwt, but it is not complete, e.g. QwtArraySeriesData is not ported for python. Now I'm using matplotlib with qtagg backend, it works fine. It's said that QtGraphs is going to replace QtCharts, but the API in C++ is not complete so far, I'll follow it. Thanks
  • Pyside6 on embedded linux

    Unsolved 14 Oct 2024, 15:11
    0 Votes
    2 Posts
    221 Views
    Hello, I’m running into the exact same problem on a Raspberry Pi with the latest Debian and a fresh PySide6 6.9.0 install—there simply isn’t any eglfs_kms support. If I switch to the eglfs_linuxfb backend, everything works perfectly, so I suspect the KMS integration might be deliberately omitted in the pip-distributed Qt for PySide6. For now I’m sticking with linuxfb, but I’d like to understand what limitations this entails compared to KMS (I don’t need multi-screen setups, 3D acceleration or video playback). I even managed to build a custom Qt from source with KMS support, but haven’t been able to persuade PySide6 to use that build instead of its bundled Qt. I also tried building PySide6 from source with qt_path pointed at my custom Qt, but that didn’t work either. Any insights into why eglfs_kms isn’t included, or how to make PySide6 pick up my KMS-enabled Qt, would be greatly appreciated.
  • FocusOutEvent get stuck in a loop

    Unsolved 10 days ago
    0 Votes
    7 Posts
    135 Views
    I've been digging through this some more and what appears to be happening is when I press tab to leave line_edit1 it goes to my focusOutEvent of CustomLineEdit1 and sets the focus back to line_edit1 but it is like the focus has also transferred over to line_edit2 so when the super().setfocus of line_edit1 happens then line_edit2 sees that and fires off it's focusOutEvent and this keeps going back and forth since they each see the focus leaving their respective line edits. If I remove the super().setfocus from the else of line_edit2 things work because there is nothing telling it to take the focus back away from line_edit1. The problem with this is that after I do go on to line_edit2 and tab out of it to go to line_edit3, with out the super().setfocus in the else the focus does not return to line_edit2 like I need it to. The event.accept() have had no effect. Unless there is something else going on here it seems like the focus should never make it to line_edit2 if I'm intercepting the focusOutEvent of line_edit1 and changing it.
  • Defer Resize Event due to expensive resize method.

    Unsolved 30 days ago
    0 Votes
    5 Posts
    172 Views
    @SimonSchroeder I think I'm already doing what you're suggesting. I've implemented a custom resizeEvent(...) that calls timer.start() on a single shot timer every time a ResizeEvent is recieved. This also resets the timer if an event is received shortly after another. And then I perform the actual resize of the widget when the timer times out. ChatGPT Suggested using this: import sys from PyQt6.QtWidgets import QApplication, QMainWindow, QLabel from PyQt6.QtCore import QTimer, QAbstractNativeEventFilter from PyQt6.QtGui import QGuiApplication class NativeResizeFilter(QAbstractNativeEventFilter): """Listens for native window events to detect when resizing stops.""" def __init__(self, callback): super().__init__() self.callback = callback # Function to call when resize stops def nativeEventFilter(self, eventType, message): from ctypes import windll if eventType == "windows_generic_MSG": msg = int.from_bytes(message[:8], byteorder=sys.byteorder) WM_EXITSIZEMOVE = 0x0232 # Windows event when resizing stops if msg == WM_EXITSIZEMOVE: self.callback() return False, 0 It seems (!) to be potentially possible to do the deferred scaling using events on Windows. I've also looked into dealing with NativeEvents on MacOS and Linux however, it seems to be rather tedious. So as for now, I've opted to go with the timer and maybe do the fancy resizing if I have the time to spare. AliSot2000
  • This topic is deleted!

    Unsolved 12 days ago
    0 Votes
    1 Posts
    9 Views
    No one has replied
  • QMediaPlayer with reduced video resolution

    Moved Unsolved 17 days ago
    0 Votes
    4 Posts
    106 Views
    So the backend uses ffmpeg however I don't think that you currently can delegate the resizing to it. You could do it in a sink though but I am unsure about the performance of it.
  • Hiding viewer panel vs window maximization

    Moved Unsolved 22 days ago
    0 Votes
    2 Posts
    72 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 19 days ago
    0 Votes
    2 Posts
    87 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 20 days ago
    0 Votes
    1 Posts
    11 Views
    No one has replied
  • 0 Votes
    2 Posts
    88 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 18 Mar 2025, 09:24
    0 Votes
    7 Posts
    408 Views
    @SGaist I get it, thx, I will try.
  • 0 Votes
    1 Posts
    113 Views
    No one has replied
  • 0 Votes
    3 Posts
    184 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
    113 Views
    No one has replied
  • This topic is deleted!

    Unsolved 24 days ago
    0 Votes
    1 Posts
    17 Views
    No one has replied
  • How to change the background color of a DockLabel instance??

    Unsolved 25 days ago
    0 Votes
    4 Posts
    151 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 25 days ago
    0 Votes
    1 Posts
    44 Views
    No one has replied
  • 0 Votes
    5 Posts
    191 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!