aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-01-14 12:30:48 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-01-14 12:30:50 +0100
commit317eb0ad107d056f4af097ff94d99233009c393d (patch)
treef4b8aaa87f49dce41400b6a05980ad8cd434728b /sources/pyside2
parent907ff205912cc8d8d0a09c8096f5089dae5eeca9 (diff)
parent2fc25e72b289b0f8e10110ffa886cad864d3147c (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Diffstat (limited to 'sources/pyside2')
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml36
-rw-r--r--sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp7
-rw-r--r--sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml2
-rw-r--r--sources/pyside2/PySide2/support/signature/mapping.py1
-rw-r--r--sources/pyside2/PySide2/templates/core_common.xml7
-rw-r--r--sources/pyside2/cmake/Macros/PySideModules.cmake6
-rw-r--r--sources/pyside2/doc/extras/PySide.QtCore.Slot.rst30
-rw-r--r--sources/pyside2/doc/pyside-config.qdocconf.in2
-rw-r--r--sources/pyside2/tests/QtCore/qmodelindex_internalpointer_test.py12
-rw-r--r--sources/pyside2/tests/registry/exists_darwin_5_12_0_ci.py4
-rw-r--r--sources/pyside2/tests/registry/exists_opensuse423_5_12_0_ci.py4
-rw-r--r--sources/pyside2/tests/registry/exists_redhatenterpriselinuxworkstation74_5_12_0_ci.py4
-rw-r--r--sources/pyside2/tests/registry/exists_win32_5_12_0_ci.py4
13 files changed, 81 insertions, 38 deletions
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index c70049d8e..7531b33b8 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -1210,6 +1210,11 @@
</add-function>
</value-type>
<value-type name="QPersistentModelIndex" hash-function="qHash">
+ <modify-function signature="internalPointer()const">
+ <inject-code class="target" position="beginning">
+ <insert-template name="return_internal_pointer" />
+ </inject-code>
+ </modify-function>
<modify-function signature="operator const QModelIndex&amp;()const">
<modify-argument index="return">
<parent index="this" action="add"/>
@@ -1460,12 +1465,38 @@
<object-type name="QAbstractItemModel">
<enum-type name="CheckIndexOption" flags="CheckIndexOptions" since="5.11"/>
<enum-type name="LayoutChangeHint"/>
+ <!-- This function was replaced by a added function -->
+ <modify-function signature="createIndex(int,int,void*)const" remove="all"/>
<!-- This function is the same as createIndex(int, int, int)const -->
<modify-function signature="createIndex(int,int,quintptr)const">
<modify-argument index="3">
<replace-default-expression with="0"/>
</modify-argument>
</modify-function>
+ <add-function signature="createIndex(int,int,PyObject*)const" return-type="QModelIndex">
+ <modify-argument index="1">
+ <rename to="row"/>
+ </modify-argument>
+ <modify-argument index="2">
+ <rename to="column"/>
+ </modify-argument>
+ <modify-argument index="3">
+ <rename to="ptr"/>
+ </modify-argument>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qabstractitemmodel-createindex"/>
+ <inject-documentation mode="append" format="target">
+ Creates a model index for the given row and column with the internal pointer ptr.
+ When using a QSortFilterProxyModel, its indexes have their own internal pointer.
+ It is not advisable to access this internal pointer outside of the model.
+ Use the data() function instead.
+ This function provides a consistent interface that model subclasses must use to create model indexes.
+
+ .. warning:: Because of some Qt/Python itegration rules, the ptr argument do not get the reference
+ incremented during the QModelIndex life time. So it is necessary to keep the object used
+ on ptr argument alive during the whole process.
+ Do not destroy the object if you are not sure about that.
+ </inject-documentation>
+ </add-function>
<inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="qabstractitemmodel"/>
<modify-function signature="mimeData(QModelIndexList)const">
<modify-argument index="return">
@@ -2774,6 +2805,11 @@
</modify-function>
</object-type>
<value-type name="QModelIndex" hash-function="qHash">
+ <modify-function signature="internalPointer()const">
+ <inject-code class="target" position="beginning">
+ <insert-template name="return_internal_pointer" />
+ </inject-code>
+ </modify-function>
<modify-function signature="model()const">
<modify-argument index="return">
<define-ownership class="target" owner="default"/>
diff --git a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
index 93a8f281e..e50b1dfc7 100644
--- a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
+++ b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
@@ -40,6 +40,7 @@
#include "pysidequickregistertype.h"
#include <pyside.h>
+#include <pyside_p.h>
#include <shiboken.h>
// Auto generated headers.
@@ -122,7 +123,7 @@ void registerTypeIfInheritsFromClass(
PyTypeObject *typeToRegister,
const QByteArray &typePointerName,
const QByteArray &typeListName,
- QMetaObject *typeMetaObject,
+ const QMetaObject *typeMetaObject,
QQmlPrivate::RegisterType *type,
bool &registered)
{
@@ -199,9 +200,7 @@ bool quickRegisterType(PyObject *pyObj, const char *uri, int versionMajor, int v
return false;
// Used inside macros to register the type.
- QMetaObject *metaObject =
- reinterpret_cast<QMetaObject *>(
- ObjectType::getTypeUserData(reinterpret_cast<SbkObjectType *>(pyObj)));
+ const QMetaObject *metaObject = PySide::retrieveMetaObject(pyObj);
Q_ASSERT(metaObject);
diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
index e6021bfe1..456a411d3 100644
--- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
+++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
@@ -660,7 +660,7 @@
<modify-argument index="2">
<reference-count action="set"/>
</modify-argument>
- <inject-code file="../glue/qtwidgets.cpp" snippet="qitemeditorfactory-registerEditor"/>
+ <inject-code file="../glue/qtwidgets.cpp" snippet="qitemeditorfactory-registereditor"/>
</modify-function>
<modify-function signature="setDefaultFactory(QItemEditorFactory*)">
<modify-argument index="1">
diff --git a/sources/pyside2/PySide2/support/signature/mapping.py b/sources/pyside2/PySide2/support/signature/mapping.py
index 61fa2d41f..96afd3c7a 100644
--- a/sources/pyside2/PySide2/support/signature/mapping.py
+++ b/sources/pyside2/PySide2/support/signature/mapping.py
@@ -63,6 +63,7 @@ class Reloader(Sbk_Reloader):
Sbk_Reloader.update(self, globals())
update_mapping = Reloader().update
+namespace = globals() # our module's __dict__, updated
def init_QtCore():
diff --git a/sources/pyside2/PySide2/templates/core_common.xml b/sources/pyside2/PySide2/templates/core_common.xml
index 0fe19273b..4f715ee1f 100644
--- a/sources/pyside2/PySide2/templates/core_common.xml
+++ b/sources/pyside2/PySide2/templates/core_common.xml
@@ -260,6 +260,13 @@
%PYARG_0 = Shiboken::String::fromCString(qPrintable(format));
</template>
+ <template name="return_internal_pointer">
+ %PYARG_0 = reinterpret_cast&lt;PyObject*>(%CPPSELF.%FUNCTION_NAME());
+ if (!%PYARG_0)
+ %PYARG_0 = Py_None;
+ Py_INCREF(%PYARG_0);
+ </template>
+
<!-- Helpers for modifying "bool nativeEventFilter(QByteArray, void*, long *result)"
to return a tuple of bool,long -->
<template name="return_native_eventfilter_conversion_variables">
diff --git a/sources/pyside2/cmake/Macros/PySideModules.cmake b/sources/pyside2/cmake/Macros/PySideModules.cmake
index 98efd8c73..2cbda3975 100644
--- a/sources/pyside2/cmake/Macros/PySideModules.cmake
+++ b/sources/pyside2/cmake/Macros/PySideModules.cmake
@@ -170,9 +170,9 @@ macro(create_pyside_module)
# install
install(TARGETS ${module_NAME} LIBRARY DESTINATION "${PYTHON_SITE_PACKAGES}/PySide2")
- install(DIRECTORY "${CMAKE_BINARY_DIR}/" DESTINATION "${PYTHON_SITE_PACKAGES}"
- OPTIONAL
- FILES_MATCHING PATTERN "*.pyi")
+ file(GLOB hinting_stub_files RELATIVE "${CMAKE_CURRENT_BINARY_DIR}/PySide2" "${CMAKE_CURRENT_BINARY_DIR}/PySide2/*.pyi")
+ install(FILES ${hinting_stub_files}
+ DESTINATION "${PYTHON_SITE_PACKAGES}/PySide2")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PySide2/${module_NAME}/pyside2_${lower_module_name}_python.h
DESTINATION include/PySide2${pyside2_SUFFIX}/${module_NAME}/)
diff --git a/sources/pyside2/doc/extras/PySide.QtCore.Slot.rst b/sources/pyside2/doc/extras/PySide.QtCore.Slot.rst
index 6b93014cf..3bc64c03a 100644
--- a/sources/pyside2/doc/extras/PySide.QtCore.Slot.rst
+++ b/sources/pyside2/doc/extras/PySide.QtCore.Slot.rst
@@ -7,33 +7,33 @@ Slot
Detailed Description
--------------------
- PySide adopt PyQt's new signal and slot syntax as-is. The PySide
- implementation is functionally compatible with the PyQt 4.5 one, with the
- exceptions listed bellow.
+ PySide2 adopt PyQt5's new signal and slot syntax as-is. The PySide2
+ implementation is functionally compatible with the PyQt5 one, with the
+ exceptions listed below.
- PyQt's new signal and slot style utilizes method and decorator names
+ PyQt5's new signal and slot style utilizes method and decorator names
specific to their implementation. These will be generalized according to
the table below:
- ======= ====================== =============
- Module PyQt factory function PySide class
- ======= ====================== =============
- QtCore pyqtSignal Signal
- QtCore pyqtSlot Slot
- ======= ====================== =============
+ ======= ======================= =============
+ Module PyQt5 factory function PySide2 class
+ ======= ======================= =============
+ QtCore pyqtSignal Signal
+ QtCore pyqtSlot Slot
+ ======= ======================= =============
Q_INVOKABLE
-----------
- PySide doesn't offer something identical to Q_INVOKABLE macro of Qt, the
- reason is simple, PySide slots can have return values, so if you need to
- create a invokable method that returns some value, declare it as a slot,
- e.g.:
+ There is no equivalent of the Q_INVOKABLE macro of Qt
+ since PySide2 slots can actually have return values.
+ If you need to create a invokable method that returns some value,
+ declare it as a slot, e.g.:
::
class Foo(QObject):
- @Slot(result=int, float)
+ @Slot(float, result=int)
def getFloatReturnInt(self, f):
return int(f)
diff --git a/sources/pyside2/doc/pyside-config.qdocconf.in b/sources/pyside2/doc/pyside-config.qdocconf.in
index e897069ad..3fd567165 100644
--- a/sources/pyside2/doc/pyside-config.qdocconf.in
+++ b/sources/pyside2/doc/pyside-config.qdocconf.in
@@ -1,6 +1,8 @@
buildversion = @PYSIDE_QT_VERSION@
navigation.homepage = Qt for Python
+macro.nullptr = "\\c{None}"
+
outputdir = @DOC_DATA_DIR@
outputformats = WebXML
WebXML.quotinginformation = true
diff --git a/sources/pyside2/tests/QtCore/qmodelindex_internalpointer_test.py b/sources/pyside2/tests/QtCore/qmodelindex_internalpointer_test.py
index a67bb380a..770600ea3 100644
--- a/sources/pyside2/tests/QtCore/qmodelindex_internalpointer_test.py
+++ b/sources/pyside2/tests/QtCore/qmodelindex_internalpointer_test.py
@@ -33,7 +33,6 @@
import sys
import unittest
from PySide2.QtCore import *
-from PySide2.support import VoidPtr
class MyModel (QAbstractListModel):
pass
@@ -51,21 +50,20 @@ class TestQModelIndexInternalPointer(unittest.TestCase):
def testInternalPointer(self):
#Test QAbstractListModel.createIndex and
- #QModelIndex.internalPointer
+ #QModelIndex.internalPointer with regular Python objects
obj = QObject()
- obj_ptr = VoidPtr(obj)
- idx = self.model.createIndex(0, 0, obj)
+ idx = self.model.createIndex(0, 0, "Hello")
i = idx.internalPointer()
- self.assertEqual(int(obj_ptr), int(i))
+ self.assertEqual(i, "Hello")
def testReferenceCounting(self):
#Test reference counting when retrieving data with
#QModelIndex.internalPointer
- o = QObject()
+ o = [1, 2, 3]
o_refcnt = sys.getrefcount(o)
idx = self.model.createIndex(0, 0, o)
ptr = idx.internalPointer()
- self.assertEqual(sys.getrefcount(o), o_refcnt)
+ self.assertEqual(sys.getrefcount(o), o_refcnt + 1)
def testIndexForDefaultDataArg(self):
diff --git a/sources/pyside2/tests/registry/exists_darwin_5_12_0_ci.py b/sources/pyside2/tests/registry/exists_darwin_5_12_0_ci.py
index a2b6aa14f..7a070abfe 100644
--- a/sources/pyside2/tests/registry/exists_darwin_5_12_0_ci.py
+++ b/sources/pyside2/tests/registry/exists_darwin_5_12_0_ci.py
@@ -157,7 +157,7 @@ if "PySide2.QtCore" in sys.modules:
"QAbstractItemModel.changePersistentIndexList": ('typing.List[int]', 'typing.List[int]'),
"QAbstractItemModel.checkIndex": ('PySide2.QtCore.QModelIndex', 'PySide2.QtCore.QAbstractItemModel.CheckIndexOptions'),
"QAbstractItemModel.columnCount": ('PySide2.QtCore.QModelIndex',),
- "QAbstractItemModel.createIndex": ('int', 'int', 'int'),
+ "QAbstractItemModel.createIndex": [('int', 'int', 'int'), ('int', 'int', 'object')],
"QAbstractItemModel.data": ('PySide2.QtCore.QModelIndex', 'int'),
"QAbstractItemModel.decodeData": ('int', 'int', 'PySide2.QtCore.QModelIndex', 'PySide2.QtCore.QDataStream'),
"QAbstractItemModel.dropMimeData": ('PySide2.QtCore.QMimeData', 'PySide2.QtCore.Qt.DropAction', 'int', 'int', 'PySide2.QtCore.QModelIndex'),
@@ -15202,7 +15202,7 @@ if "PySide2.QtHelp" in sys.modules:
"QHelpEngineCore.unregisterDocumentation": ('str',),
# class PySide2.QtHelp.QHelpIndexModel:
- "QHelpIndexModel.createIndex": [('int', 'int', 'int'), ('str',)],
+ "QHelpIndexModel.createIndex": [('int', 'int', 'int'), ('int', 'int', 'object'), ('str',)],
"QHelpIndexModel.filter": ('str', 'str'),
"QHelpIndexModel.isCreatingIndex": (),
"QHelpIndexModel.linksForKeyword": ('str',),
diff --git a/sources/pyside2/tests/registry/exists_opensuse423_5_12_0_ci.py b/sources/pyside2/tests/registry/exists_opensuse423_5_12_0_ci.py
index 5cb8a2306..6caa0947d 100644
--- a/sources/pyside2/tests/registry/exists_opensuse423_5_12_0_ci.py
+++ b/sources/pyside2/tests/registry/exists_opensuse423_5_12_0_ci.py
@@ -157,7 +157,7 @@ if "PySide2.QtCore" in sys.modules:
"QAbstractItemModel.changePersistentIndexList": ('typing.List[int]', 'typing.List[int]'),
"QAbstractItemModel.checkIndex": ('PySide2.QtCore.QModelIndex', 'PySide2.QtCore.QAbstractItemModel.CheckIndexOptions'),
"QAbstractItemModel.columnCount": ('PySide2.QtCore.QModelIndex',),
- "QAbstractItemModel.createIndex": ('int', 'int', 'int'),
+ "QAbstractItemModel.createIndex": [('int', 'int', 'int'), ('int', 'int', 'object')],
"QAbstractItemModel.data": ('PySide2.QtCore.QModelIndex', 'int'),
"QAbstractItemModel.decodeData": ('int', 'int', 'PySide2.QtCore.QModelIndex', 'PySide2.QtCore.QDataStream'),
"QAbstractItemModel.dropMimeData": ('PySide2.QtCore.QMimeData', 'PySide2.QtCore.Qt.DropAction', 'int', 'int', 'PySide2.QtCore.QModelIndex'),
@@ -15213,7 +15213,7 @@ if "PySide2.QtHelp" in sys.modules:
"QHelpEngineCore.unregisterDocumentation": ('str',),
# class PySide2.QtHelp.QHelpIndexModel:
- "QHelpIndexModel.createIndex": [('int', 'int', 'int'), ('str',)],
+ "QHelpIndexModel.createIndex": [('int', 'int', 'int'), ('int', 'int', 'object'), ('str',)],
"QHelpIndexModel.filter": ('str', 'str'),
"QHelpIndexModel.isCreatingIndex": (),
"QHelpIndexModel.linksForKeyword": ('str',),
diff --git a/sources/pyside2/tests/registry/exists_redhatenterpriselinuxworkstation74_5_12_0_ci.py b/sources/pyside2/tests/registry/exists_redhatenterpriselinuxworkstation74_5_12_0_ci.py
index 969ac36c8..c7b58c3fb 100644
--- a/sources/pyside2/tests/registry/exists_redhatenterpriselinuxworkstation74_5_12_0_ci.py
+++ b/sources/pyside2/tests/registry/exists_redhatenterpriselinuxworkstation74_5_12_0_ci.py
@@ -157,7 +157,7 @@ if "PySide2.QtCore" in sys.modules:
"QAbstractItemModel.changePersistentIndexList": ('typing.List[int]', 'typing.List[int]'),
"QAbstractItemModel.checkIndex": ('PySide2.QtCore.QModelIndex', 'PySide2.QtCore.QAbstractItemModel.CheckIndexOptions'),
"QAbstractItemModel.columnCount": ('PySide2.QtCore.QModelIndex',),
- "QAbstractItemModel.createIndex": ('int', 'int', 'int'),
+ "QAbstractItemModel.createIndex": [('int', 'int', 'int'), ('int', 'int', 'object')],
"QAbstractItemModel.data": ('PySide2.QtCore.QModelIndex', 'int'),
"QAbstractItemModel.decodeData": ('int', 'int', 'PySide2.QtCore.QModelIndex', 'PySide2.QtCore.QDataStream'),
"QAbstractItemModel.dropMimeData": ('PySide2.QtCore.QMimeData', 'PySide2.QtCore.Qt.DropAction', 'int', 'int', 'PySide2.QtCore.QModelIndex'),
@@ -15213,7 +15213,7 @@ if "PySide2.QtHelp" in sys.modules:
"QHelpEngineCore.unregisterDocumentation": ('str',),
# class PySide2.QtHelp.QHelpIndexModel:
- "QHelpIndexModel.createIndex": [('int', 'int', 'int'), ('str',)],
+ "QHelpIndexModel.createIndex": [('int', 'int', 'int'), ('int', 'int', 'object'), ('str',)],
"QHelpIndexModel.filter": ('str', 'str'),
"QHelpIndexModel.isCreatingIndex": (),
"QHelpIndexModel.linksForKeyword": ('str',),
diff --git a/sources/pyside2/tests/registry/exists_win32_5_12_0_ci.py b/sources/pyside2/tests/registry/exists_win32_5_12_0_ci.py
index 189e5c74d..0a3f587f3 100644
--- a/sources/pyside2/tests/registry/exists_win32_5_12_0_ci.py
+++ b/sources/pyside2/tests/registry/exists_win32_5_12_0_ci.py
@@ -159,7 +159,7 @@ if "PySide2.QtCore" in sys.modules:
"QAbstractItemModel.changePersistentIndexList": ('typing.List', 'typing.List'),
"QAbstractItemModel.checkIndex": ('PySide2.QtCore.QModelIndex', 'PySide2.QtCore.QAbstractItemModel.CheckIndexOptions'),
"QAbstractItemModel.columnCount": ('PySide2.QtCore.QModelIndex',),
- "QAbstractItemModel.createIndex": ('int', 'int', 'int'),
+ "QAbstractItemModel.createIndex": [('int', 'int', 'int'), ('int', 'int', 'object')],
"QAbstractItemModel.data": ('PySide2.QtCore.QModelIndex', 'int'),
"QAbstractItemModel.decodeData": ('int', 'int', 'PySide2.QtCore.QModelIndex', 'PySide2.QtCore.QDataStream'),
"QAbstractItemModel.dropMimeData": ('PySide2.QtCore.QMimeData', 'PySide2.QtCore.Qt.DropAction', 'int', 'int', 'PySide2.QtCore.QModelIndex'),
@@ -15335,7 +15335,7 @@ if "PySide2.QtHelp" in sys.modules:
"QHelpEngineCore.unregisterDocumentation": ('str',),
# class PySide2.QtHelp.QHelpIndexModel:
- "QHelpIndexModel.createIndex": [('int', 'int', 'int'), ('str',)],
+ "QHelpIndexModel.createIndex": [('int', 'int', 'int'), ('int', 'int', 'object'), ('str',)],
"QHelpIndexModel.filter": ('str', 'str'),
"QHelpIndexModel.isCreatingIndex": (),
"QHelpIndexModel.linksForKeyword": ('str',),