aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/doc/inheritance_diagram.py
diff options
context:
space:
mode:
authorShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2023-05-30 17:20:34 +0200
committerShyamnath Premnadh <Shyamnath.Premnadh@qt.io>2023-06-13 18:07:15 +0200
commit59581e630740a5216c57a6b9ee6c3742f10e4323 (patch)
tree399b7af756df5616756acb0a2d1c80a1666e3ffc /sources/pyside6/doc/inheritance_diagram.py
parentbc311d1eca86ea237d8822fe22837db7c3f46ee9 (diff)
Enum: Enable toInt for QVariant(PyEnum/SbkEnum)
- For Python/Shiboken types not known to Qt that requires wrapping around a QVariant, we use the PyObjectWrapper type. This patch registers a toInt() QMetaType converter for PyObjectWrapper, which enables automatic conversion to int for a QVariant(PyObjectWrapper) within C++ i.e. QVariant(PyObjectWrapper).toInt() will work - This means that cases like QAbstractItemModel::data() that calls QtPrivate::legacyEnumValueFromModelData(const QVariant &data) would work without explicit conversion from QVariant(PyObjectWrapper) to QVariant(int). But for cases like QMetaProperty::write() explcit handling is still required. - This would also work for cases where the QVariant(PyObjectWrapper) is simply channeled from Python to C++, and from C++ back to Python without performing any operations on it. - Incase, the wrapped object is not a PyEnum/ShibokenEnum object, then toInt() would return a -1. Pick-to: 6.5 Task-number: PYSIDE-1930 Task-number: PYSIDE-2339 Change-Id: I983351f2ff88c79c29399c257e38421116efc7a3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/doc/inheritance_diagram.py')
0 files changed, 0 insertions, 0 deletions