Skip to content

Qt for Python

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

3.3k Topics 14.7k Posts
  • Font clipping of custom Italic fonts

    Unsolved
    2
    0 Votes
    2 Posts
    27 Views
    SGaistS
    Hi and welcome to devnet, Which version of PySide6 are you using ? On which OS ? I tried on macOS with PySide 6.9.1 and it worked correctly. I just had to use the addApplicationFontFromData method because for some reason it did not succeed when loading from the file path.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • PySide on Phytec i.MX Pollux Board — Licensing and Platform Support

    Unsolved
    2
    0 Votes
    2 Posts
    46 Views
    VladimirMinenkoV
    Hi Pritha! I’m the Product Manager for Qt for Python in The Qt Group. First of all, thank you for your interest in Qt for Python and in PySide as a part of the former! I need to address few general aspects along with my answer. Speaking of “licensing considerations for using PySide in this setup”: PySide, actually PySide6 in particular, is in no way different from the “regular” Qt in that aspects. This page https://doc.qt.io/qtforpython-6/commercial/index.html in the docs outlines this. This also applies to terms for deployment. For commercial users, we outline this and other terms here https://www.qt.io/terms-conditions/qt-dev-framework-2025-02 in general, where deployment is covered in Exhibit 1 in particular. If you are a FOSS user, you have to comply with the terms of applicable OSS licenses, which are for PySide6 LGPLv3 and GPLv3. Speaking of more technical topics and the board you use: I googled a bit and found this one https://www.phytec.eu/en/produkte/development-kits/phyboard-pollux-imaging-kit/#technische-details/. This page mentions it uses Yocto. This is already a good start. Yocto is split into meta-layers. Here, initially, there is not much difference from “regular” Qt when it comes to how Qt is integrated there. Our commercial offering is Boot2Qt. It sits on top of the OSS “meta-Qt6” layer, see https://doc.qt.io/Boot2Qt/b2qt-meta-qt6.html. Boot2Qt has included PySide6 since Qt 6.8.2, see https://doc.qt.io/qtforpython-6/tutorials/embedded/boot2qt.html. This page actually mentions that it is applicable to Raspberry Pi. Raspberry Pi is one of our Tier 1 reference targets, see https://doc.qt.io/qt-6/supported-platforms.html#tier-1-reference-targets. iMX8 is also on the same list as “i.MX 8QuadMax MEK”, but I do not know what is different in your edition of iMX8 compared to “i.MX 8QuadMax MEK.” This is something that one of the embedded folks should answer. Generally, NXP is a good partner with Qt, and we know that Qt (including PySide6) is used in a large number of projects with iMX8. So your board should not be far off. If you are a commercial customer, you could also use Qt Support. In the case of OSS, you might have quite a more to take care of aside from your actual project since all boards are still a bit different and you also need to build Python and Qt for Python for your emebedded target and deploy it as a runtime. This is pre-made in Boot2Qt which I mentioned before. I hope it helps!
  • PyQt6: QSvgWidget does not render when loading a QByteArray instead of a file

    Unsolved
    14
    0 Votes
    14 Posts
    204 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
  • 0 Votes
    5 Posts
    622 Views
    V
    @Blady said in PySide6 with Python C API: EXC_BAD_ACCESS error when calling a method with inherited class from QRasterWindow: Hi and thanks for your welcome. Good question, I'm trying to create Qt bindings for Ada language. Some attempts with C++ were failing due to some C++ subtleties. I'm interested in helping figure out and fix the C++ subtleties. It would seem rather reasonable to do such bridging between C++ and Ada without having to resort to a completely-interpreted language.
  • QIcon crop in function of scale of the screen set in Windows settings

    Unsolved
    8
    0 Votes
    8 Posts
    130 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
    85 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
    276 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
    239 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
    345 Views
    F
    See https://doc.qt.io/qtcreator/creator-python-development.html ; you need to create a Python project first.
  • 0 Votes
    4 Posts
    216 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
    548 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
    576 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
    293 Views
    SGaistS
    Are you following this example ?
  • Is building for iOS supported?

    Unsolved
    12
    0 Votes
    12 Posts
    2k 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
    481 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
    266 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.
  • How to disable a QAction when variable x is equal to y?

    Solved
    4
    0 Votes
    4 Posts
    262 Views
    W
    Thanks for the help. I ended up just checking the variable inside the function the action triggers so it gets disabled as needed when it's used. It's working perfectly now.