Skip to content

Qt for Python

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

3.3k Topics 14.8k Posts
  • How to optimize dlls when compiling using Nuitka for PySide6?

    Solved
    6
    0 Votes
    6 Posts
    177 Views
    SGaistS
    You might also want to check for the plugins you don't use. That said, it might be worth checking with the nuitka folks about supporting the exclusion of Qt modules rather than having to list all the dlls.
  • Qt Creator Design Mode for QML

    Unsolved
    6
    1 Votes
    6 Posts
    4k Views
    S
    I know this is an old post, but as I have searched the forums for this problem and could not find any solution i will post my findings here. As the code suggests it could not found a qt kit. In the kit menu, after a fresh install it has a qt kit and a python kit. Now the python kit does not contains the qt, and the qt kit does not contains the python env. The solution is easy, create a new kit that has both python and qt set. But simply creating a new one will not show the python option. In the default settings filter you need to tick python to visible, then in your new kit you can select both. After using this new kit you can use the designer.
  • 0 Votes
    4 Posts
    91 Views
    GrecKoG
    in QML it would have been: ScrollView { TextArea { TextField { anchors { right: parent.right bottom: parent.bottom margins: 16 } } } } As said by JonB in widgets you could override the parent resizeEvent or install an eventFilter handling QEvent::Resize on it and call your QTextField move function.
  • This topic is deleted!

    Solved
    3
    0 Votes
    3 Posts
    21 Views
  • Parent-child closing windows in pyside6

    Unsolved
    2
    0 Votes
    2 Posts
    115 Views
    SGaistS
    Hi, From the top of my head: opening widgets upon opening widgets within a constructor is usually bad design. Even more when the window variable is local to the function. I would recommend properly building your widgets and only after that start your business logic and have proper functions that will create and further show these widgets.
  • OS-independent colour scheme with PySide6

    Solved
    7
    0 Votes
    7 Posts
    364 Views
    H
    @SimonSchroeder said in OS-independent colour scheme with PySide6: @SGaist said in OS-independent colour scheme with PySide6: I am wondering whether the red should be a bit darker in the the dark mode. This could certainly help. In the same way, it could help to make the white lines a light gray instead. I'd love to do that, but there lies my "Qt rookie" problem again, I see many ways but don't know best practice. I have presently used roles everywhere, and the lines have the "text" role which makes them white in Win 11 dark mode. When a light/dark switch happens while the app is open, QT6 does everything for me, except the green background of the "Weight" input field, which signifies a valid SymPy expression. I made that with style sheets, so it updates only when the field redraws. Right after a dark-to-light switch the field will still be a darker green with white text. Would the proper way be to do the gray line with style sheets, detect a mode change, and redraw, or can I add roles that then update automatically at light/dark switch? Or should I work with two palettes?
  • close bottom window of QMainWindow

    Unsolved
    7
    0 Votes
    7 Posts
    424 Views
    JonBJ
    @C.J.-Mejias Given that you say: self.setWindowFlags(self.windowFlags() & ~Qt.WindowMinMaxButtonsHint) # does not work self.setWindowFlags( flags = Qt.Window | Qt.WindowCloseButtonHint) # does work I would check before executing the first statement what self.windowFlags() had in it --- did it include Qt.Window and Qt.WindowCloseButtonHint to start with? And for that matter also what it returns after that statement, so that we know what the flags have actually been changed to. All it should be doing is switching off whatever is in Qt.WindowMinMaxButtonsHint, which should not be anything to do with Qt.Window or Qt.WindowCloseButtonHint. You have not yet discovered whether this change in behaviour is to do with Qt, PySide or Python.
  • 0 Votes
    11 Posts
    1k Views
    B
    @Ville-Voutilainen thanks for the information. The order of declaration shall be the same in C++ and Ada. If the order change on C++ side, you must regenerate all. I guess this also implies to get the exact source code that have been used to build Qt library which has been released. Generating Ada code from headers needs to set judiciously all defines that may differ from an OS to another. I don't know how to cope with that. Binding of multi-inheritance classes will be an issue too. I would like to hope that it succeeds, but I haven't seen any new elements to that end.
  • Qt3d - camera transforms not working

    Unsolved
    2
    0 Votes
    2 Posts
    231 Views
    SGaistS
    Hi, There might be chances but you need to provide a minimal reproducer script for people to get started to debug things.
  • ModernGL with QOpenGLWidget isn't rendering

    Solved qt for python
    8
    0 Votes
    8 Posts
    2k Views
    W
    dont use self.ctx.clear in paintGL because its can make your shader into black fill, so you just write ctx.clear in initializeGL like this def initializeGL(self): self.ctx = moderngl.create_context() self.ctx.clear(0,0,0,0)
  • Reliable position to pop context menus for tray icon on left click with Wayland

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    J
    Use KStatusNotifierItem with setIsMenu(True) will give the desired effect. KStatusNotifierItem's python bindings can be installed through your system package manager (so can't be used in a venv so far).
  • 0 Votes
    1 Posts
    134 Views
    No one has replied
  • Problem with exception handling in QOpenGLWidget

    Solved qt for python pyside
    5
    0 Votes
    5 Posts
    334 Views
    A
    Yes, sorry. I've got carried away. I do understand your point. And I agree that it's best to avoid situations where there are unhandled exceptions in Python code called from Qt. Because it may prevent some important code on the C++ side from executing. I'm just confused by the difference in this case, as the behavior changes between versions and when overriding methods in other classes. The thing is, in my short experience with PySide6, I somehow assumed the wrapper handled exception forwarding back to Python automatically. Apparently, that is not the case and I've been lucky until recently. I'll take your suggestion. @JonB said in Problem with exception handling in QOpenGLWidget: There may be better approached (I am not a Python expert), but to help debugging you might write everything like this: try: <your code> except Exception as e: unhandled_exception(e) <suitable continuation> def unhandled_exception(e): print (e) The only difference is that instead of print, I'll use logging.error to get an exception traceback. Thank you for your time!
  • Pre-allocating a space to insert my specialized widget

    Unsolved
    2
    0 Votes
    2 Posts
    181 Views
    JonBJ
    @BegBlev So that I understand --- and I am more C++ than Python --- are you using Designer's Promote to ... from the widget's context menu, e.g. as per https://www.pythonguis.com/tutorials/embed-pyqtgraph-custom-widgets-qt-app/ ?
  • Resources text file unable to be opened in Windows, but works fine in Linux

    Solved
    15
    1 Votes
    15 Posts
    1k Views
    T
    For anyone else who is having issues similar to mine: I have confirmed that by running pyside6-rcc with --compress-algo zlib allows for the creation of a resources file that works cross-platform, at the cost of a larger resources file size. So, if you need cross-platform compatibility for your resources files that are generated on Linux but pulled on other platforms, be sure to use zlib as the compression algorithm, rather than the default of zstd (which isn't even available on Windows). I'm going to mark this as solved, but will be going through the bug report I mentioned above to hopefully get some documentation written about this inconsistency.
  • 0 Votes
    3 Posts
    421 Views
    R
    Thank you very much for your reply. I have used 3.10. It works when I upgrade to 3.12.
  • PySide6.QtGraphs.QSurfaceDataProxy.resetArrayNp called with wrong argument types:

    Solved
    7
    0 Votes
    7 Posts
    407 Views
    SGaistS
    @G4IXT Hi, As an alternative you can very well install PySide6 in your conda environment using pip. That way you can use conda to manage your environments.
  • macOS Trackpad Gestures - Simultaneous Pinch & Pan?

    Unsolved
    2
    0 Votes
    2 Posts
    387 Views
    jsulmJ
    @mjiggidyj said in macOS Trackpad Gestures - Simulatneous Pinch & Pan?: any positional info I get from the QNativeGestureEvent during pinch (from pos(), etc) is not updated What about https://doc.qt.io/qt-6/qnativegestureevent.html#delta ?
  • [PySide6] Unable to listen to DBUS ScreenSaver ActiveChanged Signal

    Unsolved pyside
    1
    0 Votes
    1 Posts
    207 Views
    No one has replied
  • Did pyside6 ever support macOS 10.13?

    Unsolved
    2
    0 Votes
    2 Posts
    318 Views
    I
    It doesn't appear so, no. The minimal version ever supported by Qt 6 (as seen in the 6.0 documentation archives) is 10.14 - https://doc.qt.io/archives/qt-6.0/supported-platforms.html.