From 5d458c258fbaf3b24ffa0132093be4d6af2f8dfd Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 15 Nov 2017 14:15:16 +0100 Subject: Add Qt3D Task-number: PYSIDE-487 Change-Id: I17100eda57fbe5015b6c8ff531a3c62b22e8de95 Reviewed-by: Alexandru Croitor --- sources/pyside2/PySide2/QtCore/typesystem_core_common.xml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sources/pyside2/PySide2/QtCore') diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index 0ff1c681a..406fa5b96 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -3107,6 +3107,8 @@ + + -- cgit v1.2.3 From 9e13e1446c2479dd514f71b37bcb3cb8f78fd065 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 30 Jan 2018 18:41:13 +0100 Subject: Suppress some anonymous enum warnings Task-number: PYSIDE-587 Change-Id: I9f78ed0c66e4bb9db463f04fe77a8fc63413cd83 Reviewed-by: Friedemann Kleint --- sources/pyside2/PySide2/QtCore/typesystem_core_common.xml | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sources/pyside2/PySide2/QtCore') diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index 406fa5b96..85e1e3714 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -4280,4 +4280,12 @@ s1.addTransition(button.clicked, s1h)</code> + + + + + + + + -- cgit v1.2.3 From 4939437004cdce2d718da806daf1d90f7499e410 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 30 Jan 2018 18:54:04 +0100 Subject: Remove some harmless shiboken warnings when ran on QtCore Change-Id: I1ce182621862f57ee555999cdd7a18eecc60ffe1 Reviewed-by: Friedemann Kleint --- sources/pyside2/PySide2/QtCore/typesystem_core_common.xml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sources/pyside2/PySide2/QtCore') diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index 85e1e3714..0eaf4165e 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -4288,4 +4288,8 @@ s1.addTransition(button.clicked, s1h)</code> + + + + -- cgit v1.2.3 From 4566f0cba5ed5cccbec4706e343b4fd68400ff2c Mon Sep 17 00:00:00 2001 From: Cristian Maureira-Fredes Date: Thu, 1 Feb 2018 15:11:18 +0100 Subject: Apply Qt guidelines to the injected code via XML There are many inconsistencies in the associated typesystem files that complement the binding generation, this is a first attempt to try to standardize it. Just Qt Coding Style were applied (when possible). In the future the process to access and manipulate Shiboken objects must also be standardized. Change-Id: Ida57d1630a893bc5b608f64119b4c8d638bb9c66 Reviewed-by: Friedemann Kleint --- .../PySide2/QtCore/typesystem_core_common.xml | 198 ++++++++++----------- 1 file changed, 97 insertions(+), 101 deletions(-) (limited to 'sources/pyside2/PySide2/QtCore') diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index 0eaf4165e..2f7ed5b9f 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -268,7 +268,7 @@ - bool py2kStrCheck(PyObject* obj) + bool py2kStrCheck(PyObject *obj) { #ifdef IS_PY3K return false; @@ -283,15 +283,15 @@ const int N = %in.length(); - wchar_t* str = new wchar_t[N]; + wchar_t *str = new wchar_t[N]; %in.toWCharArray(str); - PyObject* %out = PyUnicode_FromWideChar(str, N); + PyObject *%out = PyUnicode_FromWideChar(str, N); delete[] str; return %out; - Py_UNICODE* unicode = PyUnicode_AS_UNICODE(%in); + Py_UNICODE *unicode = PyUnicode_AS_UNICODE(%in); #if defined(Py_UNICODE_WIDE) // cast as Py_UNICODE can be a different type %out = QString::fromUcs4((const uint*)unicode); @@ -316,9 +316,9 @@ const int N = %in.toString().length(); - wchar_t* str = new wchar_t[N]; + wchar_t *str = new wchar_t[N]; %in.toString().toWCharArray(str); - PyObject* %out = PyUnicode_FromWideChar(str, N); + PyObject *%out = PyUnicode_FromWideChar(str, N); delete[] str; return %out; @@ -369,7 +369,7 @@ Shiboken::Conversions::SpecificConverter converter(cppInRef.typeName()); if (converter) { - void* ptr = cppInRef.data(); + void *ptr = cppInRef.data(); return converter.toPython(ptr); } PyErr_Format(PyExc_RuntimeError, "Can't find converter for '%s'.", %in.typeName()); @@ -409,7 +409,7 @@ // a class supported by QVariant? int typeCode; - const char* typeName = QVariant_resolveMetaType(%in->ob_type, &typeCode); + const char *typeName = QVariant_resolveMetaType(%in->ob_type, &typeCode); if (!typeCode || !typeName) return; QVariant var(typeCode, (void*)0); @@ -432,11 +432,11 @@ - static const char* QVariant_resolveMetaType(PyTypeObject* type, int* typeId) + static const char *QVariant_resolveMetaType(PyTypeObject *type, int *typeId) { if (PyObject_TypeCheck(type, &SbkObjectType_Type)) { - SbkObjectType* sbkType = (SbkObjectType*)type; - const char* typeName = Shiboken::ObjectType::getOriginalName(sbkType); + SbkObjectType *sbkType = (SbkObjectType*)type; + const char *typeName = Shiboken::ObjectType::getOriginalName(sbkType); if (!typeName) return 0; bool valueType = '*' != typeName[qstrlen(typeName) - 1]; @@ -456,8 +456,8 @@ // that has added any python fields or slots to its object layout. // See https://mail.python.org/pipermail/python-list/2009-January/520733.html if (type->tp_bases) { - for(int i = 0; i < PyTuple_GET_SIZE(type->tp_bases); ++i) { - const char* derivedName = QVariant_resolveMetaType((PyTypeObject*)PyTuple_GET_ITEM(type->tp_bases, i), typeId); + for (int i = 0; i < PyTuple_GET_SIZE(type->tp_bases); ++i) { + const char *derivedName = QVariant_resolveMetaType((PyTypeObject*)PyTuple_GET_ITEM(type->tp_bases, i), typeId); if (derivedName) return derivedName; } @@ -469,13 +469,13 @@ *typeId = 0; return 0; } - static QVariant QVariant_convertToValueList(PyObject* list) + static QVariant QVariant_convertToValueList(PyObject *list) { if (PySequence_Size(list) < 1) return QVariant(); Shiboken::AutoDecRef element(PySequence_GetItem(list, 0)); int typeId; - const char* typeName = QVariant_resolveMetaType(element.cast<PyTypeObject*>(), &typeId); + const char *typeName = QVariant_resolveMetaType(element.cast<PyTypeObject*>(), &typeId); if (typeName) { QByteArray listTypeName("QList<"); listTypeName += typeName; @@ -498,8 +498,8 @@ bool allString = true; Shiboken::AutoDecRef fast(PySequence_Fast(list, "Failed to convert QVariantList")); Py_ssize_t size = PySequence_Fast_GET_SIZE(fast.object()); - for(int i = 0; i < size; ++i) { - PyObject* item = PySequence_Fast_GET_ITEM(fast.object(), i); + for (int i = 0; i < size; ++i) { + PyObject *item = PySequence_Fast_GET_ITEM(fast.object(), i); if (!%CHECKTYPE[QString](item)) { allString = false; break; @@ -507,14 +507,14 @@ } return allString; } - static QVariant QVariant_convertToVariantMap(PyObject* map) + static QVariant QVariant_convertToVariantMap(PyObject *map) { Py_ssize_t pos = 0; Shiboken::AutoDecRef keys(PyDict_Keys(map)); if (!QVariant_isStringList(keys)) return QVariant(); - PyObject* key; - PyObject* value; + PyObject *key; + PyObject *value; QMap<QString,QVariant> ret; while (PyDict_Next(map, &pos, &key, &value)) { QString cppKey = %CONVERTTOCPP[QString](key); @@ -523,7 +523,7 @@ } return QVariant(ret); } - static QVariant QVariant_convertToVariantList(PyObject* list) + static QVariant QVariant_convertToVariantList(PyObject *list) { if (QVariant_isStringList(list)) { QList<QString > lst = %CONVERTTOCPP[QList<QString>](list); @@ -536,7 +536,7 @@ Shiboken::AutoDecRef fast(PySequence_Fast(list, "Failed to convert QVariantList")); Py_ssize_t size = PySequence_Fast_GET_SIZE(fast.object()); for (int i = 0; i < size; ++i) { - PyObject* pyItem = PySequence_Fast_GET_ITEM(fast.object(), i); + PyObject *pyItem = PySequence_Fast_GET_ITEM(fast.object(), i); QVariant item = %CONVERTTOCPP[QVariant](pyItem); lst.append(item); } @@ -547,12 +547,12 @@ - const char* typeName = QVariant::typeToName(%in); - PyObject* %out; - PyTypeObject* pyType = 0; + const char *typeName = QVariant::typeToName(%in); + PyObject *%out; + PyTypeObject *pyType = nullptr; if (typeName) pyType = Shiboken::Conversions::getPythonTypeObject(typeName); - %out = pyType ? ((PyObject*)pyType) : Py_None; + %out = pyType ? (reinterpret_cast<PyObject*>(pyType)) : Py_None; Py_INCREF(%out); return %out; @@ -561,17 +561,17 @@ %out = QVariant::Invalid; - const char* typeName; + const char *typeName; if (Shiboken::String::checkType((PyTypeObject*)%in)) typeName = "QString"; - else if (%in == (PyObject*)&PyFloat_Type) + else if (%in == reinterpret_cast<PyObject*>(&PyFloat_Type)) typeName = "double"; // float is a UserType in QVariant. - else if (%in == (PyObject*)&PyLong_Type) + else if (%in == reinterpret_cast<PyObject*>(&PyLong_Type)) typeName = "int"; // long is a UserType in QVariant. else if (%in->ob_type == &SbkObjectType_Type) typeName = Shiboken::ObjectType::getOriginalName((SbkObjectType*)%in); else - typeName = ((PyTypeObject*)%in)->tp_name; + typeName = (reinterpret_cast<PyTypeObject*>(%in))->tp_name; %out = QVariant::nameToType(typeName); @@ -581,12 +581,7 @@ %out = QVariant::nameToType("QVariantMap"); - const char* typeName; - if (QVariantType_isStringList(%in)) - typeName = "QStringList"; - else - typeName = "QVariantList"; - %out = QVariant::nameToType(typeName); + %out = QVariantType_isStringList(%in) ? QVariant::StringList : QVariant::List; @@ -598,13 +593,13 @@ - static bool QVariantType_isStringList(PyObject* list) + static bool QVariantType_isStringList(PyObject *list) { bool allString = true; Shiboken::AutoDecRef fast(PySequence_Fast(list, "Failed to convert QVariantList")); Py_ssize_t size = PySequence_Fast_GET_SIZE(fast.object()); - for(int i=0; i < size; i++) { - PyObject* item = PySequence_Fast_GET_ITEM(fast.object(), i); + for (int i=0; i < size; i++) { + PyObject *item = PySequence_Fast_GET_ITEM(fast.object(), i); if (!%CHECKTYPE[QString](item)) { allString = false; break; @@ -612,7 +607,7 @@ } return allString; } - static bool QVariantType_checkAllStringKeys(PyObject* dict) + static bool QVariantType_checkAllStringKeys(PyObject *dict) { Shiboken::AutoDecRef keys(PyDict_Keys(dict)); return QVariantType_isStringList(keys); @@ -763,13 +758,12 @@