41 Commits

Author SHA1 Message Date
Denis Rouzaud
9059f200a0
Add QtQuickWidgets pyqt5_to_pyqt6.py (#60128)
* Add QtQuickWidgets pyqt5_to_pyqt6.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update pyqt5_to_pyqt6.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-01-16 11:49:10 +01:00
Nicolas Godet
9515c1ac29 [pyqt5to6] Add warning if PyQt5 if found 2025-01-07 14:22:08 +01:00
Denis Rouzaud
0f032e5f2d run pre-commit on all files 2024-11-29 15:38:02 +01:00
Julien Cabieces
a6f34a37bc
fix(pyqt5To6): Avoid endless recursion because of baseClass (#58785)
baseClass is an attribute added by sipify script
Fixes #58659
2024-09-18 12:35:39 +02:00
Nyall Dawson
d9232bdbf1 pyqt5_to_pyqt6: Handle QPainter.HighQualityAntialiasing
This is obsolete even in Qt5, should be QPainter.RenderHint.Antialiasing
2024-05-22 09:35:11 +02:00
Nyall Dawson
aa52e4b392 [pyqt5_to_pyqt6] More exhaustive searching for deprecated QFontMetrics methods 2024-05-22 14:30:23 +10:00
Nyall Dawson
d2a173fdcf Fix pyqt5_to_pqt6 script when src_to_tokens returns duplicate tokens
Sometimes src_to_tokens returns multiple tokens at the same offset.
This is likely a bug in some versions of tokenize_rt, but this
workaround avoids an exception occurring in the QGIS script.
2024-05-16 12:41:21 +02:00
Nyall Dawson
967cc5b6de [pyqt5toqt6] Add warning for activated[str] signal connections 2024-03-04 12:26:20 +10:00
Nyall Dawson
c4342425eb [pyqt5toqt6] Warn on compiled resource usage 2024-02-28 11:23:47 +10:00
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