-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Plugin migration to be compatible with Qt5 and Qt6
Étienne Trimaille edited this page Jan 8, 2025
·
8 revisions
It's possible to make a plugin for both Qt5 and Qt6.
pip install astpretty tokenize-rt
- Install
python3-pyqt6
,python3-pyqt6.qtsvg
,python3-pyqt6.qsci
- Download the script available on GitHub
- You should check that
PyQt5
is not available in the Python environment, the script will work better pyqt5_to_pyqt6.py /path/to/plugin
- Edit the
metadata.txt
by addingsupportsQt6=True
This will get you in the right direction but might not do all necessary changes. Make sure to test your plugin thoroughly. Consider using an IDE with inspection that can notify you about broken imports, bad usage or non-existent references.
- Removed Modules in Qt 6.0
- Porting to Qt 6
- Changes to Qt Modules in Qt 6
- Qt Namespace, all enums in Qt
To make a code working for both versions, it's mostly about how enums are called. For instance, according to Qt Namespace :
Working only in PyQt5 | Working for both PyQt5 and PyQt6 |
---|---|
Qt.UserRole | Qt.ItemDataRole.UserRole |
Qt.WaitCursor | Qt.CursorShape.WaitCursor |
Qt.blue | Qt.GlobalColor.blue |