- Qt for Python/GettingStarted
- Using Qt Creator as a project explorer
- Troubleshooting / Known Issues
- Developing Qt for Python Applications
- Setting Up PySide6
- Selecting the Python Interpreter
- Creating a Virtual Environment
- Using Python Interactive Shell
- Qt for Python Getting Started¶
- General Requirements¶
- Guides per platform¶
- Testing the installation¶
- Running Tests¶
- Building the documentation¶
- 1. Building rst-only documentation (no API)¶
- 2. Building the documentation (rst + API)¶
- Viewing offline documentation¶
- Using the internal tools¶
Qt for Python/GettingStarted
Refer to the official docs to start building and using Qt for Python.
Using Qt Creator as a project explorer
Qt Creator 4.0+ can be used to open the PySide and Shiboken CMakeLists.txt files as projects, and thus provide usual IDE features for developing PySide — project file navigation, code completion (C++ only), following symbols under cursor (C++ only), syntax highlighting, locator usage, debugging, etc.
Currently, there is a limitation that Shiboken has to be built first using the terminal because the installed shiboken CMake packages will have to be specified for the PySide project in Qt Creator.
The steps for opening the projects in Qt Creator are:
- Open pyside-setup/sources/shiboken2/CMakeLists.txt and specify a 5.12+ Qt Kit to be used
- Build the project as usual (by pressing the build icon for instance)
- Open pyside-setup/sources/pyside2/CMakeLists.txt and specify the same 5.12+ Qt Kit
- Go to the projects tab, and under the Build / CMake section find the Shiboken2_DIR setting. You have to specify the path to the folder where the Shiboken CMake package was installed when you compiled Shiboken from the terminal·
- An example path under macOS is /Users/user/Dev/pyside2-setup/pyside_install/py3.6-qt5.12.1-64bit-debug/lib/cmake/Shiboken2-2.0.0. The path has to be adjusted depending on the user folder name, the version of python and qt, etc
- (Optional) On MacOS you also have to set the ALTERNATIVE_QT_INCLUDE_DIR setting to the Qt kit include path (e.g. /Users/user/Dev/qt511_source/include)
- Apply the CMake configuration changes (by pressing the button), and you should be able to build PySide
Now you can use the project explorer to look through the source cpp files, python files, use the locator feature to open files and file classes / methods, and other features that Qt Creator provides.
Troubleshooting / Known Issues
- Qt 5.9 does not work with OpenSSL 1.1
- When doing a custom Qt build (some unspecified versions for now), It is necessary to have an OpenSSL version of 1.0.x, since there are compatibility issues with newer versions of OpenSSL (see details)
- The only workaround is to uninstall any module from the system, then PySide2 can look at only the Qt path currently being use.
python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
- Building failing because graphviz wasn’t found. If you’re using pyenv and installed it using pip, try to install it using your package manager:
dnf install graphviz.x86_64 #Fedora
PYTHON_CONFIGURE_OPTS="--enable-shared --with-trace-refs"
PYTHON_CONFIGURE_OPTS="--enable-shared --with-trace-refs" pyenv install -kg 3.9.13
Developing Qt for Python Applications
For more information about developing with Qt for Python, including limitations, see Qt for Python.
Setting Up PySide6
If you have not installed the required version of PySide6, Qt Creator prompts you to do so when you open a .py file.
python checklibs.py /path/to/some.app/Contents/MacOS/Some
python create_changelog.py -r 5.15.1 -v v5.15.0..5.15 -t bug-fix
python missing_bindings.py --qt-version 5.15.1 -w all
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.