32 Commits

Author SHA1 Message Date
Nyall Dawson
256f2826f3 [pyqt5toqt6] Replace invalid QVariant() constructor with NULL
This approach works for both Qt5 and Qt6 builds
2024-02-14 13:17:34 +10:00
Nyall Dawson
12c62dc9cd [pyqt5toqt6] Warn on removed QDesktopWidget use 2024-02-13 08:13:43 +10:00
Nyall Dawson
4b35ad67ad [pyqt5toqt6] Raise warning on QFontMetrics.width()
This is removed in Qt6. Use QFontMetrics.horizontalAdvance()
if plugin can safely require Qt >= 5.11, or
QFontMetrics.boundingRect().width() otherwise
2024-02-12 14:22:37 +10:00
Nyall Dawson
ad91789f9e Fix pyqt5_to_pyqt6 double unnesting some enums 2024-02-12 12:19:10 +10:00
Nyall Dawson
8f3944dabd Don't use QVariant(QVariant.Type) for NULL values in Python
Instead use qgis.core.NULL, so that the correct logic applies
for Qt6.
2024-02-07 19:35:28 +10:00
Nyall Dawson
68a7ce0eb5 pyqt5toqt6: replace from PyQt.Qt imports with PyQt.QtCore import Qt 2024-02-01 17:22:00 +10:00
Nyall Dawson
0acf51e8e5 pyqt5toqt6: Catch QDateTime(QDate) constructor and replace with
QDateTime(QDate, QTime)
2024-01-31 09:07:06 +01:00
Nyall Dawson
310b9172fb pyqt5to6: raise warnings on fragile addAction calls
The object.addAction variants with multiple arguments have changed
signature in Qt 6. It's safer to explicitly create a QAction first
and then add to an object using:

    my_action=QAction(...)
    obj.addAction(my_action)

It's a considerably less fragile syntax to use in any case!

Fixes errors when trying to show context menu in Python console
on Qt 6 builds
2024-01-31 10:55:33 +10:00
Nyall Dawson
8c3ac3f3a3 pyqt5to6: Catch QVariant.Type.XX and replace with QVariant.XX
QVariant.Type doesn't exist, the values should be referenced
directly
2024-01-31 10:55:33 +10:00
Nyall Dawson
0bc45a4c90 pyqt5_to_pyqt6: Fix qApp, warn on QRegExp
Auto replace qApp with QApplication.instance()
Raise warnings if script imports QRegExp. We can't auto replace
with QRegularExpression here, the API is just way too different.
2024-01-29 09:17:02 +01:00
Nyall Dawson
7ab6c68bb5 Add warning when required import not automatically addable 2024-01-26 14:46:39 +10:00
Nyall Dawson
0c6b5b70bc pyqt5_to_pyqt6: Handle QDateTime constructor variant
The QDateTime (yyyy, mm, dd, hh, MM, ss, ms, ts) constructor
doesn't work anymore, so port to the more reliable QDateTime(QDate,
QTime) format
2024-01-26 14:46:39 +10:00
Nyall Dawson
a5487de9f3 Handle enums referenced using subclass too 2024-01-22 19:02:40 +10:00
Nyall Dawson
3e802ee42a Replace deprecated item roles 2024-01-22 19:02:40 +10:00
Nyall Dawson
02cbea36a8 pyqt5 to 6: rename exec_ to exec
This is compatible with both qt5 and qt 6
2024-01-22 05:46:15 +10:00
Nyall Dawson
753b96ea97 More flake fixes 2024-01-19 19:44:48 +10:00
Nyall Dawson
62e4918290 Ignore some flake warnings 2024-01-19 19:44:48 +10:00
Nyall Dawson
08e2f1e77e Correctly handle name clashes between enum keys and namespaced classes 2024-01-19 19:44:48 +10:00
Nyall Dawson
e87f789821 Handle ambiguous monkey patched enum unscoping 2024-01-19 19:44:48 +10:00
Nyall Dawson
bf77b1359c Handle replacement of monkey patched PyQGIS enums 2024-01-19 19:44:48 +10:00
Nyall Dawson
d21727203b Check that enum values actually exist before replacing 2024-01-19 19:44:48 +10:00
Nyall Dawson
5012d7de4b Never try to process auto_additions folder 2024-01-19 19:44:48 +10:00
Nyall Dawson
b9b8fa9a6e Put some logic in place to handle some ambiguous enum values 2024-01-19 19:44:48 +10:00
Nyall Dawson
e6f1fda10c Don't try to upgrade ambiguous enums 2024-01-19 19:44:48 +10:00
Nyall Dawson
0ddff200c3 Scope PyQGIS enums too 2024-01-19 19:44:48 +10:00
Nyall Dawson
88eb9779e9 Flip logic in pyqt5_to_pyqt6 so that by default we only apply qgis3
compatible changes
2024-01-19 19:44:48 +10:00
Nyall Dawson
0f28531aa6 Better approach to upgrading enum flags 2024-01-19 19:44:48 +10:00
Nyall Dawson
f7d0603240 Flake 2024-01-19 19:44:48 +10:00
Nyall Dawson
9fab1623a3 Update deprecated removed enum value 2024-01-19 19:44:48 +10:00
Nyall Dawson
4fc5138a28 Upgrade some enum members which are invisible to python introspection 2024-01-19 19:44:48 +10:00
Nyall Dawson
23df946386 Handle QSci enums in pyqt5 to qt6 2024-01-19 19:44:48 +10:00
Julien Cabieces
8e19402bc5 s/3to4/pyqt5_to_pyqt6 2024-01-10 21:15:27 +10:00