diff options
-rw-r--r-- | sources/pyside6/tests/QtCore/snake_prop_feature_test.py | 22 | ||||
-rw-r--r-- | sources/shiboken6/libshiboken/bindingmanager.cpp | 5 |
2 files changed, 21 insertions, 6 deletions
diff --git a/sources/pyside6/tests/QtCore/snake_prop_feature_test.py b/sources/pyside6/tests/QtCore/snake_prop_feature_test.py index 18a5e4058..61e0b5d63 100644 --- a/sources/pyside6/tests/QtCore/snake_prop_feature_test.py +++ b/sources/pyside6/tests/QtCore/snake_prop_feature_test.py @@ -46,7 +46,8 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from PySide6.QtWidgets import QApplication, QWidget +from PySide6.QtCore import Property, QSize +from PySide6.QtWidgets import QApplication, QMainWindow, QWidget from PySide6.support import __feature__ """ @@ -150,6 +151,25 @@ class FeatureTest(unittest.TestCase): self.assertTrue(isinstance(UserClass.someFunc2, FunctionType)) self.assertTrue(isinstance(UserClass.add_action, MethodDescriptorType)) + def testTrueProperyCanOverride(self): + from __feature__ import true_property + + class CustomWidget(QWidget): + global prop_result + prop_result = None + + @Property(QSize) + def minimumSizeHint(self): + global prop_result + print("called") + prop_result = super().minimumSizeHint + return prop_result + + window = QMainWindow() + window.setCentralWidget(CustomWidget(window)) + window.show() + self.assertTrue(isinstance(prop_result, QSize)) + if __name__ == '__main__': unittest.main() diff --git a/sources/shiboken6/libshiboken/bindingmanager.cpp b/sources/shiboken6/libshiboken/bindingmanager.cpp index 0fc6ab78f..516ee3815 100644 --- a/sources/shiboken6/libshiboken/bindingmanager.cpp +++ b/sources/shiboken6/libshiboken/bindingmanager.cpp @@ -289,11 +289,6 @@ PyObject *BindingManager::getOverride(const void *cptr, int flag = currentSelectId(Py_TYPE(wrapper)); int propFlag = isdigit(methodName[0]) ? methodName[0] - '0' : 0; - if ((flag & 0x02) != 0 && (propFlag & 3) != 0) { - // PYSIDE-1019: Handle overriding with properties. - // They cannot be overridden (make that sure by the metaclass). - return nullptr; - } bool is_snake = flag & 0x01; PyObject *pyMethodName = nameCache[is_snake]; // borrowed if (pyMethodName == nullptr) { |