aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-03-03 14:25:22 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-03-10 11:19:20 +0100
commit2f82c63889cc9330ad759eea88f5a18e1821dfac (patch)
tree6099d42ffe755c5b8f6b29bdf4c29b5df0cd3cca /sources/pyside6/PySide6
parent077b30d72614f8d2176335f03e3a8568ccbcedc6 (diff)
PySide6: Move injected code snippets where they belong
Adapt to the restructuring in Qt 6. Change-Id: I3cd65b8ee428fcc75de010efaa3595664a00eb97 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6')
-rw-r--r--sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml8
-rw-r--r--sources/pyside6/PySide6/QtOpenGL/typesystem_opengl.xml8
-rw-r--r--sources/pyside6/PySide6/QtStateMachine/typesystem_statemachine.xml14
-rw-r--r--sources/pyside6/PySide6/glue/qtcore.cpp59
-rw-r--r--sources/pyside6/PySide6/glue/qtgui.cpp24
-rw-r--r--sources/pyside6/PySide6/glue/qtopengl.cpp52
-rw-r--r--sources/pyside6/PySide6/glue/qtstatemachine.cpp101
-rw-r--r--sources/pyside6/PySide6/glue/qtwidgets.cpp14
8 files changed, 184 insertions, 96 deletions
diff --git a/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml b/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml
index c8a9b2be2..bd2c99c91 100644
--- a/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml
+++ b/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml
@@ -206,15 +206,15 @@
<modify-argument index="4">
<replace-default-expression with="Qt::WindowShortcut"/>
</modify-argument>
- <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="qshortcut-1"/>
- <inject-code class="target" position="end" file="../glue/qtwidgets.cpp" snippet="qshortcut-2"/>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qshortcut-1"/>
+ <inject-code class="target" position="end" file="../glue/qtgui.cpp" snippet="qshortcut-2"/>
</add-function>
<add-function signature="QShortcut(QKeySequence::StandardKey,QObject*,PyCallable*,Qt::ShortcutContext)">
<modify-argument index="4">
<replace-default-expression with="Qt::WindowShortcut"/>
</modify-argument>
- <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="qshortcut-1"/>
- <inject-code class="target" position="end" file="../glue/qtwidgets.cpp" snippet="qshortcut-2"/>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qshortcut-1"/>
+ <inject-code class="target" position="end" file="../glue/qtgui.cpp" snippet="qshortcut-2"/>
</add-function>
</object-type>
diff --git a/sources/pyside6/PySide6/QtOpenGL/typesystem_opengl.xml b/sources/pyside6/PySide6/QtOpenGL/typesystem_opengl.xml
index 9183f8bda..8a1ed777b 100644
--- a/sources/pyside6/PySide6/QtOpenGL/typesystem_opengl.xml
+++ b/sources/pyside6/PySide6/QtOpenGL/typesystem_opengl.xml
@@ -122,16 +122,16 @@
<modify-function signature="^setUniformValue\(const char\*,(float|int|uint)\)$" remove="all"/>
<!-- No need for a signature for GLuint, since Qt (internally) calls the same function: glUniform1i -->
<add-function signature="setUniformValue1f(const char*, float)" return-type="void">
- <inject-code file="../glue/qtgui.cpp" snippet="qopenglshaderprogram_setuniformvalue_float"/>
+ <inject-code file="../glue/qtopengl.cpp" snippet="qopenglshaderprogram_setuniformvalue_float"/>
</add-function>
<add-function signature="setUniformValue1i(const char*, int)" return-type="void">
- <inject-code file="../glue/qtgui.cpp" snippet="qopenglshaderprogram_setuniformvalue_int"/>
+ <inject-code file="../glue/qtopengl.cpp" snippet="qopenglshaderprogram_setuniformvalue_int"/>
</add-function>
<add-function signature="setUniformValue1f(int, float)" return-type="void">
- <inject-code file="../glue/qtgui.cpp" snippet="qopenglshaderprogram_setuniformvalue_float"/>
+ <inject-code file="../glue/qtopengl.cpp" snippet="qopenglshaderprogram_setuniformvalue_float"/>
</add-function>
<add-function signature="setUniformValue1i(int, int)" return-type="void">
- <inject-code file="../glue/qtgui.cpp" snippet="qopenglshaderprogram_setuniformvalue_int"/>
+ <inject-code file="../glue/qtopengl.cpp" snippet="qopenglshaderprogram_setuniformvalue_int"/>
</add-function>
</object-type>
<object-type name="QOpenGLTexture" since="5.2">
diff --git a/sources/pyside6/PySide6/QtStateMachine/typesystem_statemachine.xml b/sources/pyside6/PySide6/QtStateMachine/typesystem_statemachine.xml
index a14c740d7..fad8b1edf 100644
--- a/sources/pyside6/PySide6/QtStateMachine/typesystem_statemachine.xml
+++ b/sources/pyside6/PySide6/QtStateMachine/typesystem_statemachine.xml
@@ -147,7 +147,7 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
<modify-argument index="2">
<replace-default-expression with="0"/>
</modify-argument>
- <inject-code file="../glue/qtcore.cpp" snippet="qsignaltransition"/>
+ <inject-code file="../glue/qtstatemachine.cpp" snippet="qsignaltransition"/>
</add-function>
</object-type>
@@ -164,7 +164,8 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
<modify-argument index="return">
<parent index="this" action="add"/>
</modify-argument>
- <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qstate-addtransition-1"/>
+ <inject-code class="target" position="beginning" file="../glue/qtstatemachine.cpp"
+ snippet="qstate-addtransition-1"/>
</modify-function>
<modify-function signature="addTransition(QAbstractState*)">
<modify-argument index="1">
@@ -179,7 +180,8 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
<modify-argument index="return">
<parent index="this" action="add"/>
</modify-argument>
- <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qstate-addtransition-2"/>
+ <inject-code class="target" position="beginning" file="../glue/qtstatemachine.cpp"
+ snippet="qstate-addtransition-2"/>
</add-function>
<modify-function signature="removeTransition(QAbstractTransition*)">
@@ -208,13 +210,15 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
</modify-function>
<add-function signature="configuration()" return-type="QSet&lt;QAbstractState*&gt;">
- <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qstatemachine-configuration"/>
+ <inject-code class="target" position="beginning" file="../glue/qtstatemachine.cpp"
+ snippet="qstatemachine-configuration"/>
</add-function>
<!-- Replaced by a added function -->
<modify-function signature="defaultAnimations()const" remove="all"/>
<add-function signature="defaultAnimations()" return-type="QList&lt;QAbstractAnimation*&gt;">
- <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qstatemachine-defaultanimations"/>
+ <inject-code class="target" position="beginning" file="../glue/qtstatemachine.cpp"
+ snippet="qstatemachine-defaultanimations"/>
</add-function>
</object-type>
diff --git a/sources/pyside6/PySide6/glue/qtcore.cpp b/sources/pyside6/PySide6/glue/qtcore.cpp
index 27ad9797c..b0d47606e 100644
--- a/sources/pyside6/PySide6/glue/qtcore.cpp
+++ b/sources/pyside6/PySide6/glue/qtcore.cpp
@@ -1392,65 +1392,6 @@ if (func)
%PYARG_0 = PySideEasingCurveFunctor::callable(%PYSELF);
// @snippet qeasingcurve-customtype
-// @snippet qsignaltransition
-if (PyObject_TypeCheck(%1, PySideSignalInstanceTypeF())) {
- PyObject *dataSource = PySide::Signal::getObject((PySideSignalInstance *)%PYARG_1);
- Shiboken::AutoDecRef obType(PyObject_Type(dataSource));
- QObject * sender = %CONVERTTOCPP[QObject *](dataSource);
- //XXX /|\ omitting this space crashes shiboken!
- if (sender) {
- const char *dataSignature = PySide::Signal::getSignature((PySideSignalInstance *)%PYARG_1);
- QByteArray signature(dataSignature); // Append SIGNAL flag (2)
- signature.prepend('2');
- %0 = new QSignalTransitionWrapper(sender, signature, %2);
- }
-}
-// @snippet qsignaltransition
-
-// @snippet qstate-addtransition-1
-QByteArray signalName(%2);
-signalName.remove(0, 1);
-if (PySide::SignalManager::registerMetaMethod(%1, signalName.constData(),
- QMetaMethod::Signal)) {
- QSignalTransition *%0 = %CPPSELF->addTransition(%1, %2, %3);
- %PYARG_0 = %CONVERTTOPYTHON[QSignalTransition *](%0);
-} else {
- Py_INCREF(Py_None);
- %PYARG_0 = Py_None;
-}
-// @snippet qstate-addtransition-1
-
-// @snippet qstate-addtransition-2
-// Obviously the label used by the following goto is a very awkward solution,
-// since it refers to a name very tied to the generator implementation.
-// Check bug #362 for more information on this
-// http://bugs.openbossa.org/show_bug.cgi?id=362
-if (!PyObject_TypeCheck(%1, PySideSignalInstanceTypeF()))
- goto Sbk_%TYPEFunc_%FUNCTION_NAME_TypeError;
-PySideSignalInstance *signalInstance = reinterpret_cast<PySideSignalInstance *>(%1);
-auto sender = %CONVERTTOCPP[QObject *](PySide::Signal::getObject(signalInstance));
-QSignalTransition *%0 = %CPPSELF->%FUNCTION_NAME(sender, PySide::Signal::getSignature(signalInstance),%2);
-%PYARG_0 = %CONVERTTOPYTHON[QSignalTransition *](%0);
-// @snippet qstate-addtransition-2
-
-// @snippet qstatemachine-configuration
-%PYARG_0 = PySet_New(0);
-for (auto *abs_state : %CPPSELF.configuration()) {
- Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractState *](abs_state));
- Shiboken::Object::setParent(self, obj);
- PySet_Add(%PYARG_0, obj);
-}
-// @snippet qstatemachine-configuration
-
-// @snippet qstatemachine-defaultanimations
-%PYARG_0 = PyList_New(0);
-for (auto *abs_anim : %CPPSELF.defaultAnimations()) {
- Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractAnimation *](abs_anim));
- Shiboken::Object::setParent(self, obj);
- PyList_Append(%PYARG_0, obj);
-}
-// @snippet qstatemachine-defaultanimations
-
// @snippet qt-signal
%PYARG_0 = Shiboken::String::fromFormat("2%s",QMetaObject::normalizedSignature(%1).constData());
// @snippet qt-signal
diff --git a/sources/pyside6/PySide6/glue/qtgui.cpp b/sources/pyside6/PySide6/glue/qtgui.cpp
index cc0f23cba..76932c07b 100644
--- a/sources/pyside6/PySide6/glue/qtgui.cpp
+++ b/sources/pyside6/PySide6/glue/qtgui.cpp
@@ -139,16 +139,6 @@ if (doc) {
}
// @snippet qtextblock-userdata
-// @snippet qopenglshaderprogram_setuniformvalue_float
-float value = %2;
-%CPPSELF.setUniformValue(%1, value);
-// @snippet qopenglshaderprogram_setuniformvalue_float
-
-// @snippet qopenglshaderprogram_setuniformvalue_int
-int value = %2;
-%CPPSELF.setUniformValue(%1, value);
-// @snippet qopenglshaderprogram_setuniformvalue_int
-
// @snippet qpolygon-reduce
const Py_ssize_t count = %CPPSELF.count();
PyObject *points = PyList_New(count);
@@ -552,6 +542,20 @@ WId id = %1;
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
// @snippet qwindow-fromWinId
+// @snippet qshortcut-1
+%0 = new %TYPE(%1, %2);
+// @snippet qshortcut-1
+
+// @snippet qshortcut-2
+Shiboken::AutoDecRef result(PyObject_CallMethod(%PYSELF,
+ const_cast<char *>("connect"),
+ const_cast<char *>("OsO"),
+ %PYSELF, SIGNAL(activated()), %PYARG_3)
+ );
+if (!result.isNull())
+ Shiboken::Object::setParent(%PYARG_2, %PYSELF);
+// @snippet qshortcut-2
+
/*********************************************************************
* CONVERSIONS
********************************************************************/
diff --git a/sources/pyside6/PySide6/glue/qtopengl.cpp b/sources/pyside6/PySide6/glue/qtopengl.cpp
new file mode 100644
index 000000000..0abd1cf3a
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtopengl.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*********************************************************************
+ * INJECT CODE
+ ********************************************************************/
+
+// @snippet qopenglshaderprogram_setuniformvalue_float
+float value = %2;
+%CPPSELF.setUniformValue(%1, value);
+// @snippet qopenglshaderprogram_setuniformvalue_float
+
+// @snippet qopenglshaderprogram_setuniformvalue_int
+int value = %2;
+%CPPSELF.setUniformValue(%1, value);
+// @snippet qopenglshaderprogram_setuniformvalue_int
diff --git a/sources/pyside6/PySide6/glue/qtstatemachine.cpp b/sources/pyside6/PySide6/glue/qtstatemachine.cpp
new file mode 100644
index 000000000..8a00bd3fd
--- /dev/null
+++ b/sources/pyside6/PySide6/glue/qtstatemachine.cpp
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*********************************************************************
+ * INJECT CODE
+ ********************************************************************/
+
+// @snippet qsignaltransition
+if (PyObject_TypeCheck(%1, PySideSignalInstanceTypeF())) {
+ PyObject *dataSource = PySide::Signal::getObject((PySideSignalInstance *)%PYARG_1);
+ Shiboken::AutoDecRef obType(PyObject_Type(dataSource));
+ QObject * sender = %CONVERTTOCPP[QObject *](dataSource);
+ //XXX /|\ omitting this space crashes shiboken!
+ if (sender) {
+ const char *dataSignature = PySide::Signal::getSignature((PySideSignalInstance *)%PYARG_1);
+ QByteArray signature(dataSignature); // Append SIGNAL flag (2)
+ signature.prepend('2');
+ %0 = new QSignalTransitionWrapper(sender, signature, %2);
+ }
+}
+// @snippet qsignaltransition
+
+// @snippet qstate-addtransition-1
+QByteArray signalName(%2);
+signalName.remove(0, 1);
+if (PySide::SignalManager::registerMetaMethod(%1, signalName.constData(),
+ QMetaMethod::Signal)) {
+ QSignalTransition *%0 = %CPPSELF->addTransition(%1, %2, %3);
+ %PYARG_0 = %CONVERTTOPYTHON[QSignalTransition *](%0);
+} else {
+ Py_INCREF(Py_None);
+ %PYARG_0 = Py_None;
+}
+// @snippet qstate-addtransition-1
+
+// @snippet qstate-addtransition-2
+// Obviously the label used by the following goto is a very awkward solution,
+// since it refers to a name very tied to the generator implementation.
+// Check bug #362 for more information on this
+// http://bugs.openbossa.org/show_bug.cgi?id=362
+if (!PyObject_TypeCheck(%1, PySideSignalInstanceTypeF()))
+ goto Sbk_%TYPEFunc_%FUNCTION_NAME_TypeError;
+PySideSignalInstance *signalInstance = reinterpret_cast<PySideSignalInstance *>(%1);
+auto sender = %CONVERTTOCPP[QObject *](PySide::Signal::getObject(signalInstance));
+QSignalTransition *%0 = %CPPSELF->%FUNCTION_NAME(sender, PySide::Signal::getSignature(signalInstance),%2);
+%PYARG_0 = %CONVERTTOPYTHON[QSignalTransition *](%0);
+// @snippet qstate-addtransition-2
+
+// @snippet qstatemachine-configuration
+%PYARG_0 = PySet_New(0);
+for (auto *abs_state : %CPPSELF.configuration()) {
+ Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractState *](abs_state));
+ Shiboken::Object::setParent(self, obj);
+ PySet_Add(%PYARG_0, obj);
+}
+// @snippet qstatemachine-configuration
+
+// @snippet qstatemachine-defaultanimations
+%PYARG_0 = PyList_New(0);
+for (auto *abs_anim : %CPPSELF.defaultAnimations()) {
+ Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractAnimation *](abs_anim));
+ Shiboken::Object::setParent(self, obj);
+ PyList_Append(%PYARG_0, obj);
+}
+// @snippet qstatemachine-defaultanimations
diff --git a/sources/pyside6/PySide6/glue/qtwidgets.cpp b/sources/pyside6/PySide6/glue/qtwidgets.cpp
index d3e95e3cb..b4a97c7b9 100644
--- a/sources/pyside6/PySide6/glue/qtwidgets.cpp
+++ b/sources/pyside6/PySide6/glue/qtwidgets.cpp
@@ -203,20 +203,6 @@ for (auto *act : actions) {
%CPPSELF.addAction(%1);
// @snippet qmenubar-addaction-2
-// @snippet qshortcut-1
-%0 = new %TYPE(%1, %2);
-// @snippet qshortcut-1
-
-// @snippet qshortcut-2
-Shiboken::AutoDecRef result(PyObject_CallMethod(%PYSELF,
- const_cast<char *>("connect"),
- const_cast<char *>("OsO"),
- %PYSELF, SIGNAL(activated()), %PYARG_3)
-);
-if (!result.isNull())
- Shiboken::Object::setParent(%PYARG_2, %PYSELF);
-// @snippet qshortcut-2
-
// @snippet qtoolbox-removeitem
QWidget *_widget = %CPPSELF.widget(%1);
if (_widget) {