aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-01-08 13:32:41 +0100
committerMaximilian Goldstein <max.goldstein@qt.io>2020-07-24 08:30:52 +0000
commitcc91eb893e53ea2516d895bd1861c1159d5a5c90 (patch)
tree5c9611f52052050671ec72ff6be1d906114a7840 /sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
parent9c6e82e2857e4ce45c578b73807de4b3b941ab38 (diff)
PySide2: Add qmlRegisterUncreatableType()
Extend the Quick register helper function by the bool creatable and string noCreationReason parameters, extract a QML helper taking the same parameters and add the overload. Task-number: PYSIDE-574 Change-Id: I955dbd158c7b22d2637bbac464937f9fda6d7901 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp')
-rw-r--r--sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
index 581a97dec..dc4645487 100644
--- a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
+++ b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
@@ -145,7 +145,7 @@ void registerTypeIfInheritsFromClass(
}
bool quickRegisterType(PyObject *pyObj, const char *uri, int versionMajor, int versionMinor,
- const char *qmlName, QQmlPrivate::RegisterType *type)
+ const char *qmlName, bool creatable, const char *noCreationReason, QQmlPrivate::RegisterType *type)
{
using namespace Shiboken;
@@ -186,7 +186,8 @@ bool quickRegisterType(PyObject *pyObj, const char *uri, int versionMajor, int v
return false;
type->structVersion = 0;
- type->create = createQuickItem;
+ type->create = creatable ? createQuickItem : nullptr;
+ type->noCreationReason = noCreationReason;
type->userdata = pyObj;
type->uri = uri;
type->version = QTypeRevision::fromVersion(versionMajor, versionMinor);