Skip to content

Qt for Python

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

3.4k Topics 15.1k Posts
Qt 6.12 LTS is out! See what's new in the release blog
  • PySide 6.10.0-6.10.1 upgrade changed my padding on Windows, how to restore?

    Unsolved
    6
    0 Votes
    6 Posts
    272 Views
    A
    I actually took a little more time and started comparing screenshots side by side. The padding for default theme changed in 6.10.1 and is still the same in 6.12. I think this is probably intentional and I shouldn't expect help. However, closer inspection of the windowsvista theme does have the original spacing, so I think I'll just use that when I upgrade Qt. It looks close enough I suppose. The app is from 2012 so I guess an old look is fine. I really prefer the 6.9 look but that's just a nitpick. Maybe I could request the 6.9 theme somehow? idk, what would it even be called, windows10? this is the vista theme: [image: bc04ff68-3600-4bc2-ac1a-e3eb58597eff.png]
  • 0 Votes
    3 Posts
    87 Views
    JKSHJ
    I don't know the exact tag/commit that was used for this release, but this is what I know: Qt WebEngine (and Qt PDF) have been split from Qt, with an independent release cycle: https://www.qt.io/blog/qt-webengine-will-release-separate Qt WebEngine/PDF 6.140.0 has not been released yet Qt for Python has not performed the same split yet; Qt for Python 6.12.0 inadvertently shipped with a pre-release version of Qt WebEngine/PDF I believe this should be rectified soon
  • QWidget modification at runtime

    Unsolved
    17
    0 Votes
    17 Posts
    1k Views
    SGaistS
    @SimonSchroeder I would venture that it is almost more intuitive for QStackedWidget 😅
  • Managing multiple windows

    Unsolved
    1
    0 Votes
    1 Posts
    47 Views
    No one has replied
  • PySide6 UI looks different depending on which macOS built Python

    Solved
    8
    0 Votes
    8 Posts
    335 Views
    SGaistS
    Is that white background different in other apps ?
  • QMessageBox crash on macOS 27.0.1

    Unsolved
    7
    0 Votes
    7 Posts
    513 Views
    Q
    Thanks a lot @IgKh for your inputs, it gives some light. Looking for CUINamedVectorGlyph crash with macOS 27 I found indeed a lot of reports, and this seems to be a quite well known issue... It seems the problem could come from a locale not using the period as decimal number separator such as... French locale, which is the setup my users have (comma is used as separator). This could also explain why with a US locale the problem doesn't occur. If you have means to retest my little code above with a French locale on a macOS 27.0.1 system it could be useful to verify. Thanks again.
  • PySide6 6.10.2 Windows MSIX: ICU dependencies, wheel provenance and LGPL redistribution

    Unsolved
    1
    0 Votes
    1 Posts
    141 Views
    No one has replied
  • ModuleNotFoundError: No module named 'PyQt6' using Thonny for Windows

    Unsolved
    2
    0 Votes
    2 Posts
    228 Views
    SGaistS
    Hi and welcome to devnet, I didn't know it's existence so there are a couple of things. You seem to have an existing Python setup on your system, correct ? Thonny comes with its own Python environment if installed through its package. So: How did you install Thonny ? If through its official package, did you install PyQt6 from within the IDE ? If wanting to use your existing Python environment, did you follow the separate install wiki page ?
  • No PyQt5 package for Windows?

    Unsolved
    3
    0 Votes
    3 Posts
    347 Views
    SGaistS
    Hi, PyQt5 is not a product of the Qt Company. You need to contact Riverbank computing about that matter.
  • Selection highlight is a thin blue bar at the left of the cell.

    Unsolved
    15
    0 Votes
    15 Posts
    953 Views
    S
    @Jim-G said in Selection highlight is a thin blue bar at the left of the cell.: So why does setting alternatingRowColors cause the change in highlight? Qt tries to use the OS default widgets first. Alternating row colors is not supported by the OS directly. So, Qt will draw it from scratch and usually tries to mimic the OS look. Seems like it did not get updated, yet.
  • looking for a code editor widget for Qt for Python

    Unsolved
    13
    1 Votes
    13 Posts
    5k Views
    D
    Hi. I made this gizmo https://brainless-software.github.io/qppte/ Not sure if it fits but it works for my use case.
  • Trouble setting up QDataWidgetMapper

    Solved
    9
    0 Votes
    9 Posts
    660 Views
    A
    I did in fact discover that particular quirk while trying to whittle everything down into a MRP! Figured it would be more helpful to just state my finding instead of making folks trudge through the project.
  • Possible mistake in the translation example?

    Unsolved
    7
    1 Votes
    7 Posts
    725 Views
    JKSHJ
    @axu2 said in Possible mistake in the translation example?: The website still isn't updated? The website shows the official documentation of the current release. It will update with the next release.
  • Creating Python bindings for KSyntaxHighlighter with shiboken

    Unsolved
    3
    0 Votes
    3 Posts
    877 Views
    M
    see also: looking for a code editor widget for Qt for Python
  • pyside6-lupdate does not extract translations from Python files when given a directory

    Unsolved
    2
    0 Votes
    2 Posts
    308 Views
    Nils SjobergN
    You need to pass all the .py files in the directory to pyside6-lupdate, or use pyside6-project lupdate.
  • 0 Votes
    13 Posts
    1k Views
    J
    @JonB OK, for future readers here's the code I ended up with. It's a lot simpler than all the hallucinations provided by Google. I'm pretty sure it's not the canonical way to do this but it works and I'll continue studying the links provided in this thread. import sys from PySide6.QtCore import QFile from PySide6.QtWidgets import QApplication, QVBoxLayout, QWidget from PySide6.QtUiTools import QUiLoader def load_ui(ui_file_path: str) -> QWidget: loader = QUiLoader() ui_file = QFile(ui_file_path) if not ui_file.open(QFile.ReadOnly): print("Cannot open ui file") sys.exit(-1) ui = loader.load(ui_file) ui_file.close() return ui class MainWindow(QWidget): def __init__(self, ui:QWidget): super().__init__() self.ui = ui self.setWindowTitle("My Qt Designer App") layout = QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(ui) # Load comboBox items #ui.comboBox.addItems(getLoginCandidates(dbEngine)) ui.pushButton.clicked.connect(self.on_submit_clicked) def on_submit_clicked(self): print("The button was clicked!") if __name__ == "__main__": app = QApplication(sys.argv) ui = load_ui("../ui/test.ui") window = MainWindow(ui) window.show() rc = app.exec() sys.exit(rc)
  • Detecting checkbox toggle via keyboard on a QTreeWidgetItem

    Solved
    2
    0 Votes
    2 Posts
    267 Views
    Christian EhrlicherC
    You should get a https://doc.qt.io/qt-6/qtreewidget.html#itemChanged signal when the data of an item changes.
  • 0 Votes
    4 Posts
    456 Views
    JKSHJ
    @FatesealMagic said in How do I make my QMainWindow's contents dynamically resize after floating a QDockWidget?: I tried this code on a different machine with Ot/PySide6 6.11.0 and it worked as expected. Thank you! EDIT: For completeness, apparently this issue only impacts very specific QT versions: https://stackoverflow.com/questions/79999518/how-do-i-make-my-qmainwindows-contents-dynamically-resize-after-floating-a-qdoc/79999535#79999535 Indeed: https://qt-project.atlassian.net/browse/QTBUG-147209
  • Do I need to add qmldir for python objects exposed as singleton instances?

    Unsolved
    6
    0 Votes
    6 Posts
    1k Views
    L
    hey helping you out if you've not figured it out yet since the previous poster was very vague, after some testing myself you do you need to use qmlRegisterSingletonInstance() function to regsiter an existing precreated instance from python to QML there is no decorator that does this for obvious reasons. Going for the decorator is only for regsitering it as usable property Type and/or be used by QML to create. To auto generate the qmltypes I suggest you use something like "pyside6-qml-stubgen" library I found this works best as it is able to run regsiter types even from the function if you make a seperate file that is run when imported. Then you need to add whatever folder the library generates to your QML import path for the linter to know of it if you're using something like VSCode qml extensions.
  • Pyside6 Slot with Name arg crashes app

    Unsolved
    4
    0 Votes
    4 Posts
    517 Views
    F
    That produces file:///../Example/Main.qml:11: TypeError: Property 'testMethod' of object Example/Controller is not a function - an instance of Controller is needed.