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
  • Why does PySide6 need glibc 2.39 since 6.8.1 on aarch64?

    Solved
    4
    0 Votes
    4 Posts
    200 Views
    A
    After doing some digging I found this thread. My Python project on Raspberry Pi OS requires PySide6==6.8.3 or later which depends on glibc 2.39 but RPiOS only provides 2.36. I tried building from source and containerising it with chroot but neither produced the proper result. I'm going try switching to Ubuntu Server 24.04 for Raspberry Pi and hope for the best seeing as it will have the proper glibc version. If I don't report back within the week assume that it worked.
  • Main window always opens on 'incorrect' monitor

    Solved
    4
    0 Votes
    4 Posts
    75 Views
    C
    Hi All, first things first, I am stuck on python 3.7.3. I tried upgrading to the latest supported version of pyside6 which seems to be 6.5.3. This seems to have fixed my issue. I did make a python version of @CassD script and using pyside 6.2.4, I get the following output manufacturer : model : Screen Name : LF24T450F Screen Size : PySide6.QtCore.QSize(1920, 1080) While using pyside 6.5.3, I get the following manufacturer : Samsung Electric Company model : LF24T450F Screen Name : LF24T450F (1) Screen Size : PySide6.QtCore.QSize(1920, 1080) manufacturer : Samsung Electric Company model : LF24T450F Screen Name : LF24T450F (2) Screen Size : PySide6.QtCore.QSize(1920, 1080) So it seems version 6.2.4 does have some issues detecting screens. In any case, my issue is now resolved, thanks.
  • Get XY Coordinates of QTextCursor

    Solved
    3
    0 Votes
    3 Posts
    65 Views
    D
    @IgKh Thanks so much for your direction. That was exactly what I needed! Here is the code I used: #####determine the cursor position to scroll the scrollArea as needed #get the blockBoundingRect of the block that holds the QTextCursor blockRect = self.doc.documentLayout().blockBoundingRect(self.cur.block()) #get the QTextLine that holds the QTextCursor cursorLine = self.cur.block().layout().lineForTextPosition(self.cur.positionInBlock()) #get the QTextLine's naturalTextRect so we can get the Y center of the QTextCursor self.cursorLineRect = cursorLine.naturalTextRect() #translate the cursorLineRect to the blockRect self.cursorLineRect.translate(blockRect.x(),blockRect.y()) #get the approximate X position of the cursor cursorToX = cursorLine.cursorToX(self.cur.positionInBlock(), QTextLine.Edge.Leading) #create a QPointF from the cursorToX posistion and the center of the CursorLineRect self.cursorPoint=QPointF(float(cursorToX[0])+blockRect.x(),self.cursorLineRect.center().y()) #instruct the QScrollArea to keep the QPointF visible with 100px padding self.main_window.scrollArea.ensureVisible(self.cursorPoint.x(), self.cursorPoint.y(),100,100) Then to confirm my computation was correct I painted self.cursorPoint using painter.drawPoint(self.cursorPoint) . You can see the little red dot following the text cursor in the screenshot below. Your guidance solved my problem 100% [image: 76f8252d-e31d-406b-8d53-f90af5c226ad.JPG]
  • Could not load the Qt platform plugin "windows" even though it was found

    Unsolved
    6
    0 Votes
    6 Posts
    102 Views
    JonBJ
    @memyselfandi The link @hskoglund has got found really looks like it is just your issue and should resolve!
  • Is building for iOS supported?

    Unsolved
    7
    0 Votes
    7 Posts
    189 Views
    P
    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
    4
    0 Votes
    4 Posts
    332 Views
    P
    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
    3
    0 Votes
    3 Posts
    89 Views
    jronaldJ
    @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
    2
    0 Votes
    2 Posts
    228 Views
    S
    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
    7
    0 Votes
    7 Posts
    488 Views
    B
    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
    5
    0 Votes
    5 Posts
    178 Views
    A
    @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
    1
    0 Votes
    1 Posts
    9 Views
    No one has replied
  • QMediaPlayer with reduced video resolution

    Moved Unsolved
    4
    0 Votes
    4 Posts
    119 Views
    SGaistS
    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
    2
    0 Votes
    2 Posts
    76 Views
    C
    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
    0 Votes
    2 Posts
    252 Views
    SGaistS
    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
    1
    0 Votes
    1 Posts
    11 Views
    No one has replied
  • 0 Votes
    2 Posts
    95 Views
    B
    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
    7
    0 Votes
    7 Posts
    648 Views
    L
    @SGaist I get it, thx, I will try.
  • NotImplementedError: QAsyncioEventLoop.getaddrinfo() is not implemented yet

    Unsolved
    1
    0 Votes
    1 Posts
    122 Views
    No one has replied
  • PyQt and resizing windows when widgets shrink - minimal example included

    Unsolved
    3
    0 Votes
    3 Posts
    557 Views
    B
    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.
  • Error interpreting message in nativeEvent on Windows (might be a Qt bug?)

    Unsolved pyside python
    2
    0 Votes
    2 Posts
    321 Views
    No one has replied

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.