mirror of
https://github.com/qgis/QGIS.git
synced 2025-06-22 00:02:40 -04:00
Updated Plugin migration to be compatible with Qt5 and Qt6 (markdown)
parent
5419540ace
commit
27f909d1cd
@ -8,6 +8,7 @@ It's possible to make a plugin for both Qt5 and Qt6.
|
|||||||
1. `pip install astpretty tokenize-rt`
|
1. `pip install astpretty tokenize-rt`
|
||||||
1. Install `python3-pyqt6`, `python3-pyqt6.qtsvg`, `python3-pyqt6.qsci`
|
1. Install `python3-pyqt6`, `python3-pyqt6.qtsvg`, `python3-pyqt6.qsci`
|
||||||
1. Download the script available on [GitHub](https://github.com/qgis/QGIS/blob/master/scripts/pyqt5_to_pyqt6/pyqt5_to_pyqt6.py)
|
1. Download the script available on [GitHub](https://github.com/qgis/QGIS/blob/master/scripts/pyqt5_to_pyqt6/pyqt5_to_pyqt6.py)
|
||||||
|
1. You should check that `PyQt5` is not available in the Python environment, the script will work better
|
||||||
1. `pyqt5_to_pyqt6.py /path/to/plugin`
|
1. `pyqt5_to_pyqt6.py /path/to/plugin`
|
||||||
1. Edit the `metadata.txt` by adding `supportsQt6=True`
|
1. Edit the `metadata.txt` by adding `supportsQt6=True`
|
||||||
|
|
||||||
@ -21,13 +22,11 @@ This will get you in the right direction but might not do all necessary changes.
|
|||||||
- e.g. [QAction has moved to QtGui](https://doc.qt.io/qt-6/widgets-changes-qt6.html#qaction-qactiongroup)!
|
- e.g. [QAction has moved to QtGui](https://doc.qt.io/qt-6/widgets-changes-qt6.html#qaction-qactiongroup)!
|
||||||
- [Qt Namespace](https://doc.qt.io/qt-6/qt.html), all enums in Qt
|
- [Qt Namespace](https://doc.qt.io/qt-6/qt.html), all enums in Qt
|
||||||
|
|
||||||
## Manual checks
|
## Manual conversion
|
||||||
|
|
||||||
Using the link above about [Qt Namespace](https://doc.qt.io/qt-6/qt.html), enum must changed accordingly.
|
To make a code working for both versions, it's mostly about how enums are called. For instance, according to [Qt Namespace](https://doc.qt.io/qt-6/qt.html) :
|
||||||
|
|
||||||
For instance :
|
Working only in PyQt5 | Working for both PyQt5 and PyQt6
|
||||||
|
|
||||||
PyQt5 | PyQt6
|
|
||||||
:---: | :---:
|
:---: | :---:
|
||||||
Qt.UserRole | Qt.ItemDataRole.UserRole
|
Qt.UserRole | Qt.ItemDataRole.UserRole
|
||||||
Qt.WaitCursor | Qt.CursorShape.WaitCursor
|
Qt.WaitCursor | Qt.CursorShape.WaitCursor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user