aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/pyside6/tests/QtWidgets/qlabel_test.py7
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.cpp8
2 files changed, 15 insertions, 0 deletions
diff --git a/sources/pyside6/tests/QtWidgets/qlabel_test.py b/sources/pyside6/tests/QtWidgets/qlabel_test.py
index b8bbb2902..e4b4e9f21 100644
--- a/sources/pyside6/tests/QtWidgets/qlabel_test.py
+++ b/sources/pyside6/tests/QtWidgets/qlabel_test.py
@@ -37,6 +37,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(True)
+from PySide6.QtCore import Qt
from PySide6.QtGui import QPixmap
from PySide6.QtWidgets import QLabel
from shiboken6 import Shiboken
@@ -85,6 +86,12 @@ class QLabelTest(UsesQApplication):
self.assertTrue(all(Shiboken.getCppPointer(o) != ret_p_addr
for o in Shiboken.getAllValidWrappers()))
+ # Test for PYSIDE-1673, QObject.property() returning a QFlags<> property.
+ def testQObjectProperty(self):
+ a = self.label.property("alignment")
+ self.assertEqual(type(a), Qt.Alignment)
+ print("alignment=", a)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
index 5db3d82e3..4af72beda 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
@@ -4108,6 +4108,14 @@ void CppGenerator::writeEnumConverterInitialization(TextStream &s, const TypeEnt
else
break;
}
+ if (flags) {
+ // PYSIDE-1673: Also register "QFlags<Class::Option>" purely for
+ // the purpose of finding the converter by QVariant::typeName()
+ // in the QVariant conversion code.
+ s << "Shiboken::Conversions::registerConverterName(converter, \""
+ << flags->name() << "\");\n";
+ }
+
}
s << "}\n";