Skip to content

Qt for Python

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

3.3k Topics 14.8k Posts
  • PySide vs PyQt ui file load.

    Unsolved pyside
    8
    0 Votes
    8 Posts
    1k Views
    JonBJ
    @swoiwode Yes, you have made the right changes! Note how you changed from PyQt6.uic.loadUi(ui_file, self), which loaded into self and gave you self.label etc. over to self.ui = PySide6.QtUiTools.QUiLoader().load(ui_file), which returned into a newly created self.ui (or whatever you choose to call it) and hence gave you self.ui.label etc. It's just a different way of doing things, and PySide just does not offer that parameter or loading into self. Looking around at what examples there are on the web I found that actually even in PyQt more people had worked from self.ui = PyQt6.uic.loadUi(ui_file) which is also available and similar to the PySide way than that "non-standard" PyQt6.uic.loadUi(ui_file, self) which the code you inherited had chosen to use. Honestly you came across one of the few difference between PyQt and PySide right from the outset in the small script you were working on. 99% of the time you should find that same code simply works from PyQt to PySide.
  • Pyside on Boot2Qt in RaspberryPi5

    Unsolved
    2
    0 Votes
    2 Posts
    195 Views
    jsulmJ
    @Pritha-Suresh Since you're accessing the device via ssh you need to forward X11 if you want to run a GUI application this way, see -X ssh parameter, Also the error you get hints that you did not install X11 on the device.
  • Font clipping of custom Italic fonts

    Unsolved
    3
    0 Votes
    3 Posts
    305 Views
    M
    This was with PySide6 6.9.2, I also tried with 6.10.0 The OS is Windows 10 22H2
  • PySide on Phytec i.MX Pollux Board — Licensing and Platform Support

    Unsolved
    3
    0 Votes
    3 Posts
    365 Views
    P
    Hi! Thank you for the quick response. We are not going for deployments as of now. We will be showcasing the PySide capabalities as a product demo on Phytec Board. So two points from your response, Do we need commercial license for Pyside demo on Phytec board? Can I get more info on LGPLv3 and GPLv3? Thanks in advance!
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • PyQt6: QSvgWidget does not render when loading a QByteArray instead of a file

    Unsolved
    14
    0 Votes
    14 Posts
    1k Views
    JonBJ
    @ErwanM Yes, the ones there using the R"(-type construct are shown having leading & trailing newlines which will be in the resulting string. One guy does even say All the spaces and indentation and the newlines in the string are preserved. That's up to them for their examples where it doesn't matter. In your case of <?xml we simply cannot afford that. The one which starts std::string index_html=R"html( <!DOCTYPE html> would have a newline before the <!DOCTYPE html>, but maybe that is allowed, unlike for <?xml. Or maybe it isn't allowed either and they didn't check! Anyway, there we are, that's just how it is.
  • This topic is deleted!

    Solved
    4
    0 Votes
    4 Posts
    79 Views
  • QIcon crop in function of scale of the screen set in Windows settings

    Unsolved
    8
    0 Votes
    8 Posts
    467 Views
    Christian EhrlicherC
    I would check the pixmap/image returned in _extract_icon_from_exe() if it is correct - simply save it to a png and take a look.
  • QStyledItemDelegate doesn't move with its QTreeView column

    Unsolved pyside python qt for python
    3
    0 Votes
    3 Posts
    339 Views
    jeremy_kJ
    Another option: Use a single custom delegate for the entire view, and look up the screen position of the index to determine the desired drawing style.
  • 0 Votes
    13 Posts
    1k Views
    D
    @JonB Haha yeah I might as well end up learning C++ for using Qt
  • QIcon crop when drag and display it in a QScrollArea

    Solved
    2
    0 Votes
    2 Posts
    359 Views
    SGaistS
    Hi and welcome to devnet, Why are you doing all these scaling operation to, in the end, not used that scaled pixmap ? In any case, you should start by making it work without particular scaling or fixed size. Once you have ensured that you have the icon properly working, you can start scaling the icon, and only once you are sure you have what you want, fix the size of the QLabel. That said, why not use a QListView/QListWidget to show these icon.
  • qtCreator - debug python scripts?

    Unsolved qt for python
    2
    0 Votes
    2 Posts
    512 Views
    F
    See https://doc.qt.io/qtcreator/creator-python-development.html ; you need to create a Python project first.
  • 0 Votes
    4 Posts
    549 Views
    K
    Update on the Drag-and-Drop Issue: Root Cause Identified I've identified the bug: The issue is caused by running the application as Administrator, not by having Microsoft PowerToys FancyZones enabled. Thank you to everyone who provided feedback on this issue. After further investigation, I've determined that the primary cause of the drag-and-drop failure is running the PySide6 application with administrator privileges, not the presence of Microsoft PowerToys FancyZones. Root Cause Clarification Windows implements strict security isolation between processes running at different privilege levels. When a PySide6 application runs with administrator rights, it operates in a different security context than most desktop applications (including Windows Explorer, which typically runs at standard user level). This isolation prevents the cross-process communication necessary for drag-and-drop operations to function properly, resulting in the forbidden symbol (🚫). Recommended Solution Run your PySide6 application at standard user privilege level (without administrator rights). This is the most straightforward solution and maintains normal drag-and-drop functionality. If your application genuinely requires elevated privileges for certain operations, consider: Implementing alternative file selection methods in your UI (e.g., QFileDialog for file opens, command-line argument support, or copy/paste path handling). Restructuring your application so that only the specific components needing elevated privileges run as administrator, while the main GUI runs at standard user level. Why FancyZones Might Have Seemed Related PowerToys FancyZones, which manages window layouts, might have interacted visibly with the window of an elevated application, potentially making the issue more noticeable. However, the core permission isolation issue lies with the administrator privilege level itself. Verification You can verify this by running the provided example code without administrator privileges. Drag-and-drop should function correctly, even with FancyZones enabled. Apologies for the initial confusion regarding FancyZones, and I hope this clarification helps others experiencing similar issues.
  • QMessageBox not working

    Unsolved
    5
    0 Votes
    5 Posts
    782 Views
    jsulmJ
    @Borbixxx What does your post have to do with this topic? "But my code is not running as expected" - is not a problem description. closeEvent needs to be a method in a class derived from QWidget based class.
  • Building python-pyside2 for Almalinux 9

    Unsolved
    8
    0 Votes
    8 Posts
    889 Views
    P
    I have successfully built pyside2 with your help, many thanks. I'm building it again today more cleanly with steps documentation and rpm packaging of the binaries to deploy on numerous laptops and servers running almalinux9. Next I will try to build the Fedora35 Freecad version from the source rpm. Yes latest Freecad versions are based on pyside6 and qt6, but Almalinux provides qt5 (and optionally qt6) but not PySide6. I will also try this build later.
  • Building PySide6 with development install

    Unsolved
    5
    0 Votes
    5 Posts
    794 Views
    SGaistS
    Are you following this example ?
  • Is building for iOS supported?

    Unsolved
    12
    0 Votes
    12 Posts
    3k Views
    F
    The Qt Project Contribution guidelines are explained at https://contribute.qt-project.org/guidelines . The communication channels are listed at https://wiki.qt.io/Qt_for_Python / Community . The current state of affairs is visible at https://codereview.qt-project.org/c/pyside/pyside-setup/+/651061 . Some changes have been already submitted.
  • Issues with link switching via keyboard in QPlainTextEdit

    Solved
    7
    0 Votes
    7 Posts
    673 Views
    jeremy_kJ
    @wayfarer said in Issues with link switching via keyboard in QPlainTextEdit: @jeremy_k said in Issues with link switching via keyboard in QPlainTextEdit: Have you considered QTextBrowser? It has link handling APIs, and tab navigation between links works. I was hoping to avoid having to use a different widget since I've already built most of my app around the QPlainTextEdit. Besides, I vastly prefer its scrolling behavior. QTextEdit and QTextBrowser both cut off the text when the user scrolls past it, leaving it partially visible at the top of the window. QPlainTextEdit doesn't. It's a nice visual feature that makes the app feel much smoother. Switching to QTextBrowser seems like a viable solution, though I'll have to modify my existing code to work with it. I would prefer to keep the QPlainTextEdit scrolling behavior somehow if possible. Is there any particular reason why that flag doesn't work with QPlainTextEdit? The scrolling difference is due to QPlainTextEdit's override definition of QAbstractScrollArea::scrollContentsBy. The implementation is here. My guess is that handling of links, including navigation between them, isn't seen as part of the functionality of the widget. QTextEdit also lacks navigation between links. The QPlainTextEdit::textInteractionFlags contains what may be a revealing error: Specifies how the label should interact with user input if it displays text.
  • Updating to 6.9.1 breaks code which work under 6.9.0

    Unsolved
    6
    1 Votes
    6 Posts
    1k Views
    E
    Has 6.9.2 resolved this issue? I no longer have the code I could have used to test this.
  • DLL Problems - DLL load failed -> QtCore

    Solved
    3
    0 Votes
    3 Posts
    693 Views
    B
    Found the solution. PyQt6 6.9.1 is not compatible with Python below 3.10. Updating python version helped. Leaving for the future researchers.