Skip to content

Commit 53138ee

Browse files
committed
fix: qt4 compatibility check
1 parent b8d7569 commit 53138ee

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

loopstructural/gui/compatibility.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# compat.py
22
from qgis.PyQt.QtCore import QVariant
33

4-
if hasattr(QVariant, "Int"):
5-
# QGIS 3 / PyQt5: QVariant still exposes the legacy .Type enum members.
6-
# (QMetaType is importable under PyQt5 too, so we can't use that import
7-
# to detect QGIS 4 - checking for the attribute QGIS 4 actually removed
8-
# is the only reliable signal.)
4+
if hasattr(QVariant, "Type"):
5+
# QGIS 3 / PyQt5: QVariant still exposes the legacy .Type enum.
6+
# (QMetaType is importable under PyQt5 too, and PyQt6's QVariant still
7+
# keeps scalar constants like QVariant.Int for convenience, so neither
8+
# of those can be used to detect QGIS 4 - .Type is the attribute QGIS 4
9+
# actually removed, so it's the only reliable signal.)
910
QVariantCompat = QVariant
1011
else:
1112
# QGIS 4 / PyQt6: QVariant.Type was removed; use QMetaType instead.

0 commit comments

Comments
 (0)