From 5c3f6e3e50de4c41ded289111cd1e78fd9ec369b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 6 Apr 2018 15:55:36 +0200 Subject: Fix qt_attribution.json - Move from root to sources/pyside2/PySide2/support/signature - Set "QtForPython" as module name, fixing the qtattributionsscanner warning: File ./qt_attribution.json: Missing mandatory property 'QDocModule'. - Use "Qt for Python" as in descriptions - Reference backport_inspect.py as file Task-number: PYSIDE-363 Change-Id: I5e2b546a0a2a090abebc73a38ca4077a2983f216 Reviewed-by: Christian Tismer Reviewed-by: Cristian Maureira-Fredes --- .../pyside2/PySide2/support/signature/qt_attribution.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 sources/pyside2/PySide2/support/signature/qt_attribution.json (limited to 'sources/pyside2') diff --git a/sources/pyside2/PySide2/support/signature/qt_attribution.json b/sources/pyside2/PySide2/support/signature/qt_attribution.json new file mode 100644 index 000000000..331b3e814 --- /dev/null +++ b/sources/pyside2/PySide2/support/signature/qt_attribution.json @@ -0,0 +1,12 @@ +{ + "Id": "python", + "Name": "Python", + "QDocModule": "QtForPython", + "QtUsage": "Used for Qt for Python in the signature extension.", + "Description": "Qt for Python is an add-on for Python. The signature packages of PySide uses certain copied and adapted source files (inspect.py, backport_inspect.py, typing27.py, typing36.py). See the folder sources/pyside2/PySide2/support/signature .", + "Homepage": "http://www.python.org/", + "Version": "3.6.5", + "License": "PSF LICENSE AGREEMENT FOR PYTHON 3.6.5", + "LicenseFile": "backport_inspect.py", + "Copyright": "© Copyright 2001-2018, Python Software Foundation." +} -- cgit v1.2.3 From 3895f37a83ba763cb54ea0af02282d4d7d54273b Mon Sep 17 00:00:00 2001 From: Cristian Maureira-Fredes Date: Thu, 29 Mar 2018 11:28:32 +0200 Subject: Update deprecated Qsql header Change-Id: I8e0a4e4c264c420304d29235e51190e1edac3ede Reviewed-by: Friedemann Kleint --- sources/pyside2/PySide2/QtSql/typesystem_sql.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sources/pyside2') diff --git a/sources/pyside2/PySide2/QtSql/typesystem_sql.xml b/sources/pyside2/PySide2/QtSql/typesystem_sql.xml index 46836ef96..2699f29d4 100644 --- a/sources/pyside2/PySide2/QtSql/typesystem_sql.xml +++ b/sources/pyside2/PySide2/QtSql/typesystem_sql.xml @@ -52,7 +52,7 @@ - + -- cgit v1.2.3 From a4690116881477d09f34f6b20b2ee0f31c06163d Mon Sep 17 00:00:00 2001 From: Cristian Maureira-Fredes Date: Wed, 28 Mar 2018 10:21:20 +0200 Subject: Use XINCREF/XDECREF in PyObjectWrapper constructor When emitting a None signal the PyObjectWrapper constructors in the signalmanager were not working properly, but using the safe macros to increase and decrease the references of the object solves the issue. Task-number: PYSIDE-17 Change-Id: I1871e5b8227d6ddc893afce2ab9b311b60649024 Reviewed-by: Friedemann Kleint Reviewed-by: Christian Tismer --- sources/pyside2/libpyside/signalmanager.cpp.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sources/pyside2') diff --git a/sources/pyside2/libpyside/signalmanager.cpp.in b/sources/pyside2/libpyside/signalmanager.cpp.in index 08c57c218..ca176c693 100644 --- a/sources/pyside2/libpyside/signalmanager.cpp.in +++ b/sources/pyside2/libpyside/signalmanager.cpp.in @@ -116,19 +116,19 @@ namespace PySide { PyObjectWrapper::PyObjectWrapper() :m_me(Py_None) { - Py_INCREF(m_me); + Py_XINCREF(m_me); } PyObjectWrapper::PyObjectWrapper(PyObject* me) : m_me(me) { - Py_INCREF(m_me); + Py_XINCREF(m_me); } PyObjectWrapper::PyObjectWrapper(const PyObjectWrapper &other) : m_me(other.m_me) { - Py_INCREF(m_me); + Py_XINCREF(m_me); } PyObjectWrapper::~PyObjectWrapper() @@ -139,13 +139,13 @@ PyObjectWrapper::~PyObjectWrapper() return; Shiboken::GilState gil; - Py_DECREF(m_me); + Py_XDECREF(m_me); } PyObjectWrapper& PyObjectWrapper::operator=(const PySide::PyObjectWrapper& other) { - Py_INCREF(other.m_me); - Py_DECREF(m_me); + Py_XINCREF(other.m_me); + Py_XDECREF(m_me); m_me = other.m_me; return *this; } -- cgit v1.2.3 From 4023ab3862eee7ca3084dd83ca76fba11b5db46b Mon Sep 17 00:00:00 2001 From: Cristian Maureira-Fredes Date: Tue, 27 Mar 2018 15:16:03 +0200 Subject: Add default return value to pythonTypeIsValueType When a class inherits from two base classes, Shiboken sets the converter of the newly created SbkObject to 0 (SbkObjectTypeTpNew), and handle the multiple inheritance in a different way. When any SbkObject try to release its ownership, it first verify if the ownership is already on the C++ side by checking the attribute hasOwership and also if the converter is a ValueType. The later fails if the converter is null, so a default value (false) was added. A test case using deleteLater() was included, which uses the releaseOwnership method internally. Task-number: PYSIDE-11 Change-Id: I34fba0d3e5d28b99b49a183ed08e977a311da632 Reviewed-by: Friedemann Kleint --- .../pyside2/tests/QtCore/qobject_inherits_test.py | 37 +++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'sources/pyside2') diff --git a/sources/pyside2/tests/QtCore/qobject_inherits_test.py b/sources/pyside2/tests/QtCore/qobject_inherits_test.py index 8c4c797a4..1d089776b 100644 --- a/sources/pyside2/tests/QtCore/qobject_inherits_test.py +++ b/sources/pyside2/tests/QtCore/qobject_inherits_test.py @@ -29,8 +29,12 @@ '''Test cases for QObject methods''' import unittest +import sys -from PySide2.QtCore import QObject +from PySide2.QtCore import QObject, QTimer +from PySide2.QtWidgets import QApplication, QLabel, QVBoxLayout + +is_alive = None class InheritsCase(unittest.TestCase): '''Test case for QObject.inherits''' @@ -87,5 +91,36 @@ class InheritsCase(unittest.TestCase): self.assertRaises(TypeError, declareClass) + # PYSIDE-11: + # The takeOwnership() method was relying that the SbkObject + # had a converter, which it's not the case when multiple + # inheritance is used. + # The deleteLater() method uses the takeOwnership() to give + # control of the object to C++, so it can be remove once + # the destructor is called. + # The solution was to add a default case when the object + # is null under the pythonTypeIsValueType() method in shiboken. + def testDeleteMultipleInheritance(self): + app = QApplication(sys.argv) + class DerivedLabel(QLabel, QObject): + def __del__(self): + global is_alive + is_alive = False + + global is_alive + child = DerivedLabel('Hello') + is_alive = True + parent = QVBoxLayout() + parent.addWidget(child) + parent.removeWidget(child) + child.deleteLater() + self.assertTrue(is_alive) + del child + self.assertTrue(is_alive) + QTimer.singleShot(100, app.quit) + app.exec_() + self.assertFalse(is_alive) + + if __name__ == '__main__': unittest.main() -- cgit v1.2.3 From a89690409972501741c846ac8ad4a499f2982809 Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Fri, 23 Mar 2018 19:54:42 +0100 Subject: fix more qApp crashes When building PySide with a debug Python, a lot more problems become visible. They were triggered by some malicious ordering of the shutdown code, which must come *after* the refcounts of the variables are adjusted. The initial issue PYSIDE-585 was caused because the shutdown code is not only used for every created Q*Application, but also for the module shutdown, which deletes qApp_contents too often. Instead of special-casing that or adding some refcount, it was much more intuitive in that context to set qApp_content's refcount to the same value as Py_None, which also is not supposed to be garbage collected. Btw., the reason for the error message is that Py_None has it, too. When we set qApp_content's type to Py_None's type, it inherits the protection code that prevents someone from garbage collecting Py_None. Task-number: PYSIDE-585 Change-Id: I4af9de1192730f06054a5aca099a32e2392e367d Reviewed-by: Friedemann Kleint --- sources/pyside2/libpyside/pyside.cpp | 2 +- sources/pyside2/tests/QtWidgets/CMakeLists.txt | 1 + sources/pyside2/tests/QtWidgets/qapp_issue_585.py | 68 +++++++++++++++++++++++ 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 sources/pyside2/tests/QtWidgets/qapp_issue_585.py (limited to 'sources/pyside2') diff --git a/sources/pyside2/libpyside/pyside.cpp b/sources/pyside2/libpyside/pyside.cpp index b223edc6c..4c7e6471c 100644 --- a/sources/pyside2/libpyside/pyside.cpp +++ b/sources/pyside2/libpyside/pyside.cpp @@ -162,10 +162,10 @@ static void destructionVisitor(SbkObject* pyObj, void* data) void destroyQCoreApplication() { - SignalManager::instance().clear(); QCoreApplication* app = QCoreApplication::instance(); if (!app) return; + SignalManager::instance().clear(); Shiboken::BindingManager& bm = Shiboken::BindingManager::instance(); SbkObject* pyQApp = bm.retrieveWrapper(app); diff --git a/sources/pyside2/tests/QtWidgets/CMakeLists.txt b/sources/pyside2/tests/QtWidgets/CMakeLists.txt index fa64d1c3b..c22981251 100644 --- a/sources/pyside2/tests/QtWidgets/CMakeLists.txt +++ b/sources/pyside2/tests/QtWidgets/CMakeLists.txt @@ -82,6 +82,7 @@ PYSIDE_TEST(parent_method_test.py) PYSIDE_TEST(python_properties_test.py) PYSIDE_TEST(qabstracttextdocumentlayout_test.py) PYSIDE_TEST(qaction_test.py) +PYSIDE_TEST(qapp_issue_585.py) PYSIDE_TEST(qapp_test.py) PYSIDE_TEST(qapplication_exit_segfault_test.py) PYSIDE_TEST(qapplication_singleton_test.py) diff --git a/sources/pyside2/tests/QtWidgets/qapp_issue_585.py b/sources/pyside2/tests/QtWidgets/qapp_issue_585.py new file mode 100644 index 000000000..9dd2014c0 --- /dev/null +++ b/sources/pyside2/tests/QtWidgets/qapp_issue_585.py @@ -0,0 +1,68 @@ +############################################################################# +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of PySide2. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## 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 General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## 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-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +""" +The bug was caused by this commit: +"Support the qApp macro correctly, final version incl. debug" +e30e0c161b2b4d50484314bf006e9e5e8ff6b380 +2017-10-27 + +The bug was first solved by this commit: +"Fix qApp macro refcount" +b811c874dedd14fd8b072bc73761d39255216073 +2018-03-21 + +This test triggers the refcounting bug of qApp, issue PYSIDE-585. +Finally, the real patch included more changes, because another error +was in the ordering of shutdown calls. It was found using the following +Python configuration: + + In Python 3.6 create a directory 'debug' and cd into it. + + ../configure --with-pydebug --prefix=$HOME/pydebug/ --enable-shared + +Then a lot more refcounting errors show up, which are due to a bug in +the code position of the shutdown procedure. +The reason for the initial refcount bug was that the shutdown code is once +more often called than the creation of the qApp wrapper. +Finally, it was easiest and more intuitive to simply make the refcount of +qApp_content equal to that of Py_None, which is also not supposed to be +garbage-collected. + +For some reason, the test does not work as a unittest because it creates +no crash. We leave it this way. +""" + +from PySide2.QtCore import QTimer +from PySide2 import QtWidgets + +app_instance = QtWidgets.QApplication([]) +# If the following line is commented, application doesn't crash on exit anymore. +app_instance2 = app_instance +QTimer.singleShot(0, qApp.quit) +app_instance.exec_() -- cgit v1.2.3 From f93da21b3286db1bf693c26df47a538e581ff908 Mon Sep 17 00:00:00 2001 From: Cristian Maureira-Fredes Date: Thu, 29 Mar 2018 11:13:57 +0200 Subject: Transfer ownership of new Widget to QTreeWidget When new widgets were added to a QTreeWidget the ownership was not being transferred. This problem happened when the Widget was being build inside the method call. When trying to show owner-less Widgets inside the Tree, a segfault happened. A test case was added. Task-number: PYSIDE-73 Change-Id: I0f1c3c065ae8ed0a336c8e39b1766f3e8870b54d Reviewed-by: Friedemann Kleint --- .../QtWidgets/typesystem_widgets_common.xml | 5 ++ sources/pyside2/tests/QtWidgets/CMakeLists.txt | 1 + .../pyside2/tests/QtWidgets/qtreewidget_test.py | 64 ++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 sources/pyside2/tests/QtWidgets/qtreewidget_test.py (limited to 'sources/pyside2') diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml index 0555d9a53..5f7f42290 100644 --- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml +++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml @@ -1902,6 +1902,11 @@ + + + + + diff --git a/sources/pyside2/tests/QtWidgets/CMakeLists.txt b/sources/pyside2/tests/QtWidgets/CMakeLists.txt index c22981251..0384e0a8d 100644 --- a/sources/pyside2/tests/QtWidgets/CMakeLists.txt +++ b/sources/pyside2/tests/QtWidgets/CMakeLists.txt @@ -122,6 +122,7 @@ PYSIDE_TEST(qtabwidgetclear_test.py) PYSIDE_TEST(qtextedit_test.py) PYSIDE_TEST(qtextedit_signal_test.py) PYSIDE_TEST(qtreeview_test.py) +PYSIDE_TEST(qtreewidget_test.py) PYSIDE_TEST(qtoolbar_test.py) PYSIDE_TEST(qtoolbox_test.py) PYSIDE_TEST(qvariant_test.py) diff --git a/sources/pyside2/tests/QtWidgets/qtreewidget_test.py b/sources/pyside2/tests/QtWidgets/qtreewidget_test.py new file mode 100644 index 000000000..11fa83c5a --- /dev/null +++ b/sources/pyside2/tests/QtWidgets/qtreewidget_test.py @@ -0,0 +1,64 @@ +############################################################################# +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of PySide2. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## 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 General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## 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-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +import unittest + +from PySide2.QtWidgets import QTreeWidget, QTreeWidgetItem, QPushButton +from helper import UsesQApplication + +class QTreeWidgetTest(UsesQApplication): + + # PYSIDE-73: + # There was a problem when adding items to a QTreeWidget + # when the Widget was being build on the method call instead + # of as a separate variable. + # The problem was there was not ownership transfer, so the + # QTreeWidget did not own the QWidget element + def testSetItemWidget(self): + + treeWidget = QTreeWidget() + treeWidget.setColumnCount(2) + + item = QTreeWidgetItem(['text of column 0', '']) + treeWidget.insertTopLevelItem(0, item) + # Adding QPushButton inside the method + treeWidget.setItemWidget(item, 1, + QPushButton('Push button on column 1')) + + # Getting the widget back + w = treeWidget.itemWidget(treeWidget.itemAt(0,1), 1) + self.assertIsInstance(w, QPushButton) + + p = QPushButton('New independent button') + # Adding QPushButton object from variable + treeWidget.setItemWidget(item, 0, p) + w = treeWidget.itemWidget(treeWidget.itemAt(0,0), 0) + self.assertIsInstance(w, QPushButton) + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.3 From b5debb687463f77053344f1e4cd7754275e487b2 Mon Sep 17 00:00:00 2001 From: Cristian Maureira-Fredes Date: Fri, 6 Apr 2018 16:28:22 +0200 Subject: Transfer ownership of the header to the QTreeView When using setHeader on a QTreeView, the view needs to take ownership of the header object. Task-number: PYSIDE-227 Change-Id: Ib37c00c098be422c7f0df4a32a6795c267642a41 Reviewed-by: Friedemann Kleint --- sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml | 5 +++++ sources/pyside2/tests/QtWidgets/qtreeview_test.py | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'sources/pyside2') diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml index 5f7f42290..e5e72dc65 100644 --- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml +++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml @@ -1126,6 +1126,11 @@ + + + + + diff --git a/sources/pyside2/tests/QtWidgets/qtreeview_test.py b/sources/pyside2/tests/QtWidgets/qtreeview_test.py index a731ddafa..703131ec3 100644 --- a/sources/pyside2/tests/QtWidgets/qtreeview_test.py +++ b/sources/pyside2/tests/QtWidgets/qtreeview_test.py @@ -29,7 +29,9 @@ import unittest from PySide2.QtGui import QStandardItemModel -from PySide2.QtWidgets import QWidget, QTreeView, QVBoxLayout, QStyledItemDelegate +from PySide2.QtWidgets import (QWidget, QTreeView, QVBoxLayout, + QStyledItemDelegate, QHeaderView) +from PySide2.QtCore import Qt from helper import UsesQApplication class Widget(QWidget): @@ -85,5 +87,10 @@ class QWidgetTest(UsesQApplication): t.setItemDelegate(QStyledItemDelegate()) self.assertIsInstance(t.itemDelegate(), QStyledItemDelegate) + def testHeader(self): + tree = QTreeView() + tree.setHeader(QHeaderView(Qt.Horizontal)) + self.assertIsNotNone(tree.header()) + if __name__ == '__main__': unittest.main() -- cgit v1.2.3 From 67d6c85a9dc17fe68ab399e14da73d10a1f9a351 Mon Sep 17 00:00:00 2001 From: Cristian Maureira-Fredes Date: Thu, 29 Mar 2018 14:35:28 +0200 Subject: Check default superclass when getting baseClasses Reimplementing a class must respect the closest base class instead of falling back to QObject. By adding a default-superclass argument one can verify that field first when shiboken is getting the base classes. This problem was found by reimplementing QGraphicsObject including methods from one of its parent classes, QGraphicsItem. With this change, the generated wrapper will list all the base classes in `Sbk_QGraphicsObject_Type_bases` leaving QObject at the end, because if not, it will match inmediately. A test case was included. This change doesn't affect other existing tests. Task-number: PYSIDE-86 Change-Id: I6b9a220497b12c8085302a502f8581cc2d3fb11b Reviewed-by: Friedemann Kleint --- .../QtWidgets/typesystem_widgets_common.xml | 2 +- sources/pyside2/tests/QtWidgets/CMakeLists.txt | 1 + .../tests/QtWidgets/qgraphicsobjectreimpl_test.py | 76 ++++++++++++++++++++++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 sources/pyside2/tests/QtWidgets/qgraphicsobjectreimpl_test.py (limited to 'sources/pyside2') diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml index e5e72dc65..2899be47a 100644 --- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml +++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml @@ -3641,7 +3641,7 @@ - + diff --git a/sources/pyside2/tests/QtWidgets/CMakeLists.txt b/sources/pyside2/tests/QtWidgets/CMakeLists.txt index 0384e0a8d..9caf7e365 100644 --- a/sources/pyside2/tests/QtWidgets/CMakeLists.txt +++ b/sources/pyside2/tests/QtWidgets/CMakeLists.txt @@ -93,6 +93,7 @@ PYSIDE_TEST(qdynamic_signal.py) PYSIDE_TEST(qformlayout_test.py) PYSIDE_TEST(qgraphicsitem_test.py) PYSIDE_TEST(qgraphicsitem_isblocked_test.py) +PYSIDE_TEST(qgraphicsobjectreimpl_test.py) PYSIDE_TEST(qgraphicsproxywidget_test.py) PYSIDE_TEST(qgraphicsscene_test.py) PYSIDE_TEST(qimage_test.py) diff --git a/sources/pyside2/tests/QtWidgets/qgraphicsobjectreimpl_test.py b/sources/pyside2/tests/QtWidgets/qgraphicsobjectreimpl_test.py new file mode 100644 index 000000000..fd79ce3aa --- /dev/null +++ b/sources/pyside2/tests/QtWidgets/qgraphicsobjectreimpl_test.py @@ -0,0 +1,76 @@ +############################################################################# +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of PySide2. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## 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 General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## 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-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +''' Test cases related to QGraphicsItem and subclasses''' + +import unittest + +from PySide2.QtWidgets import QGraphicsObject, QGraphicsWidget +from PySide2.QtCore import QRectF + +from helper import UsesQApplication + +class GObjA(QGraphicsObject): + def paint(self, *args): + pass + + def boundingRect(self): + return QRectF() + + def itemChange(self, *args): + return QGraphicsObject.itemChange(self, *args) + +class GObjB(QGraphicsObject): + def paint(self, *args): + pass + + def boundingRect(self): + return QRectF() + +class QGraphicsObjectReimpl(UsesQApplication): + '''Test case for reimplementing QGraphicsObject''' + + def testReimplementationTypes(self): + w = QGraphicsWidget() + + # PYSIDE-86: + # This case failed because GObjA was reimplementing + # the method itemChange() from QGraphicsItem, + # and then the QVariant was not associated with + # a QGraphicsItem but a QObjectItem because the base + # class was a QObject. + gobjA = GObjA() + gobjA.setParentItem(w) + self.assertIs(type(w), type(gobjA.parentItem())) + + gobjB = GObjB() + gobjB.setParentItem(w) + self.assertIs(type(w), type(gobjB.parentItem())) + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.3 From ad69024a695a459e2953f477d90a64004c818ff5 Mon Sep 17 00:00:00 2001 From: Cristian Maureira-Fredes Date: Thu, 29 Mar 2018 13:38:10 +0200 Subject: Remove white spaces from signature label in XMLs Change-Id: I2d41bb92335bcbd2300da29b793ce0529e57960a Reviewed-by: Friedemann Kleint Reviewed-by: Christian Tismer --- .../PySide2/QtCore/typesystem_core_common.xml | 244 ++++++++--------- .../PySide2/QtGui/typesystem_gui_common.xml | 164 +++++------ sources/pyside2/PySide2/QtHelp/typesystem_help.xml | 2 +- .../QtMultimedia/typesystem_multimedia_common.xml | 42 +-- .../PySide2/QtNetwork/typesystem_network.xml | 22 +- .../pyside2/PySide2/QtOpenGL/typesystem_opengl.xml | 82 +++--- .../QtPrintSupport/typesystem_printsupport.xml | 2 +- sources/pyside2/PySide2/QtQml/typesystem_qml.xml | 8 +- .../pyside2/PySide2/QtQuick/typesystem_quick.xml | 2 +- sources/pyside2/PySide2/QtSql/typesystem_sql.xml | 8 +- sources/pyside2/PySide2/QtSvg/typesystem_svg.xml | 4 +- sources/pyside2/PySide2/QtTest/typesystem_test.xml | 22 +- .../PySide2/QtUiTools/typesystem_uitools.xml | 12 +- .../QtWebKitWidgets/typesystem_webkitwidgets.xml | 6 +- .../QtWidgets/typesystem_widgets_common.xml | 302 ++++++++++----------- .../PySide2/QtWidgets/typesystem_widgets_mac.xml | 2 +- sources/pyside2/PySide2/QtXml/typesystem_xml.xml | 16 +- .../QtXmlPatterns/typesystem_xmlpatterns.xml | 6 +- 18 files changed, 473 insertions(+), 473 deletions(-) (limited to 'sources/pyside2') diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index e4d16b2d3..6db3691a6 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -69,7 +69,7 @@ - + @@ -895,7 +895,7 @@ - + @@ -979,9 +979,9 @@ - - - + + + @@ -1188,7 +1188,7 @@ - + @@ -1228,7 +1228,7 @@ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); - + @@ -1236,7 +1236,7 @@ - + @@ -1377,7 +1377,7 @@ - + @@ -1387,7 +1387,7 @@ %0 = new %TYPE(date, time, Qt::TimeSpec(%8)); - + QDate date(%1, %2, %3); QTime time(%4, %5, %6); @@ -1777,7 +1777,7 @@ - + @@ -1821,19 +1821,19 @@ - - - + + + - + - + @@ -1990,7 +1990,7 @@ - + %CPPSELF.unlock(); @@ -2004,7 +2004,7 @@ - + %CPPSELF.unlock(); @@ -2032,14 +2032,14 @@ - - - + + + - + @@ -2064,13 +2064,13 @@ qRegisterMetaType<QVector<int> >("QVector<int>"); - + - + @@ -2079,14 +2079,14 @@ - + - + @@ -2096,7 +2096,7 @@ - + @@ -2111,7 +2111,7 @@ - + @@ -2120,7 +2120,7 @@ - + @@ -2128,7 +2128,7 @@ - + %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(); %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); @@ -2160,7 +2160,7 @@ - + @@ -2173,7 +2173,7 @@ - + @@ -2184,7 +2184,7 @@ - + @@ -2194,7 +2194,7 @@ %PYARG_0 = %CONVERTTOPYTHON[bool](%0); - + @@ -2205,7 +2205,7 @@ - + @@ -2217,7 +2217,7 @@ - + @@ -2228,7 +2228,7 @@ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); - + @@ -2239,21 +2239,21 @@ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); - - + + %RETURN_TYPE %0 = PySide::SignalManager::instance().emitSignal(%CPPSELF, %1, %PYARG_2); %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); - + // %FUNCTION_NAME() - disable generation of function call. %RETURN_TYPE %0 = qobjectDisconnectCallback(%CPPSELF, %1, %2); %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); - + // %FUNCTION_NAME() - disable generation of function call. %RETURN_TYPE %0 = qobjectDisconnectCallback(%1, %2, %3); @@ -2263,7 +2263,7 @@ - + QObject *child = _findChildHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1); %PYARG_0 = %CONVERTTOPYTHON[QObject*](child); @@ -2275,7 +2275,7 @@ - + %PYARG_0 = PyList_New(0); _findChildrenHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1, %PYARG_0); @@ -2287,7 +2287,7 @@ - + %PYARG_0 = PyList_New(0); _findChildrenHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1, %PYARG_0); @@ -2297,7 +2297,7 @@ - + @@ -2323,7 +2323,7 @@ - + // Avoid return +1 because SignalManager connect to "destroyed()" signal to control object timelife int ret = %CPPSELF.%FUNCTION_NAME(%1); @@ -2340,14 +2340,14 @@ - + - + @@ -2417,7 +2417,7 @@ - + @@ -2529,7 +2529,7 @@ - + @@ -2561,7 +2561,7 @@ } - + Shiboken::AutoDecRef str(PyUnicode_AsASCIIString(%PYARG_1)); if (!str.isNull()) { @@ -2571,7 +2571,7 @@ } - + QByteArray ba = QByteArray(PyBytes_AS_STRING(%PYARG_1), PyBytes_GET_SIZE(%PYARG_1)) + *%CPPSELF; %PYARG_0 = %CONVERTTOPYTHON[QByteArray](ba); @@ -2603,7 +2603,7 @@ - + if (PyBytes_Check(%PYARG_1)) { @@ -2663,8 +2663,8 @@ - - + + @@ -2675,7 +2675,7 @@ - + @@ -2683,7 +2683,7 @@ - + @@ -2691,7 +2691,7 @@ - + @@ -2699,7 +2699,7 @@ - + @@ -2707,7 +2707,7 @@ - + @@ -2715,7 +2715,7 @@ - + @@ -2828,7 +2828,7 @@ - + @@ -2860,13 +2860,13 @@ - + - + - + @@ -2882,13 +2882,13 @@ - + - + - + - + @@ -2899,7 +2899,7 @@ - + QByteArray ba; ba.resize(%2); @@ -2923,7 +2923,7 @@ - + QByteArray ba; ba.resize(%2); @@ -2969,13 +2969,13 @@ - + - + %CPPSELF.unlock(); @@ -2995,12 +2995,12 @@ - + - + @@ -3075,7 +3075,7 @@ - + @@ -3091,8 +3091,8 @@ - - + + @@ -3131,7 +3131,7 @@ timer->start(%1); - + // %FUNCTION_NAME() - disable generation of c++ function call Shiboken::AutoDecRef emptyTuple(PyTuple_New(0)); @@ -3142,7 +3142,7 @@ if (PyObject_TypeCheck(%2, &PySideSignalInstanceType)) { PySideSignalInstance *signalInstance = reinterpret_cast<PySideSignalInstance*>(%2); - Shiboken::AutoDecRef signalSignature(Shiboken::String::fromFormat("2%s", PySide::Signal::getSignature(signalInstance))); + Shiboken::AutoDecRef signalSignature(Shiboken::String::fromFormat("2%s",PySide::Signal::getSignature(signalInstance))); Shiboken::AutoDecRef result( PyObject_CallMethod(pyTimer, const_cast<char*>("connect"), @@ -3183,7 +3183,7 @@ - + @@ -3201,7 +3201,7 @@ - + long result; @@ -3257,11 +3257,11 @@ - + - - + + QCoreApplication *app = QCoreApplication::instance(); @@ -3285,14 +3285,14 @@ - + - + - + @@ -3334,7 +3334,7 @@ - + .. warning:: QSettings.value can return different types (QVariant types) depending on the platform it's running on, so the safest way to use it is always casting the result to the desired type, e.g.: int(settings.value("myKey")) @@ -3345,7 +3345,7 @@ - + @@ -3620,7 +3620,7 @@ - + @@ -3677,7 +3677,7 @@ - + @@ -3700,7 +3700,7 @@ - + @@ -3714,7 +3714,7 @@ - + @@ -3745,19 +3745,19 @@ - + - + - + @@ -3772,7 +3772,7 @@ - + @@ -3783,7 +3783,7 @@ - + @@ -3809,7 +3809,7 @@ - + @@ -3843,13 +3843,13 @@ - + - + @@ -3870,7 +3870,7 @@ - + @@ -3961,7 +3961,7 @@ - + @@ -4010,7 +4010,7 @@ s1.addTransition(button.clicked, s1h)</code> - + @@ -4020,9 +4020,9 @@ s1.addTransition(button.clicked, s1h)</code> Shiboken::AutoDecRef obType(PyObject_Type(dataSource)); QObject* sender = %CONVERTTOCPP[QObject*](dataSource); if (sender) { - const char *dataSignature = PySide::Signal::getSignature((PySideSignalInstance*)%PYARG_1); + const char*dataSignature = PySide::Signal::getSignature((PySideSignalInstance*)%PYARG_1); QByteArray signature(dataSignature); // Append SIGNAL flag (2) - %0 = new QSignalTransitionWrapper(sender, "2" + signature, %2); + %0 = new QSignalTransitionWrapper(sender,"2" + signature,%2); } } @@ -4038,7 +4038,7 @@ s1.addTransition(button.clicked, s1h)</code> - + @@ -4062,7 +4062,7 @@ s1.addTransition(button.clicked, s1h)</code> - + @@ -4075,7 +4075,7 @@ s1.addTransition(button.clicked, s1h)</code> goto Sbk_%TYPEFunc_%FUNCTION_NAME_TypeError; PySideSignalInstance *signalInstance = reinterpret_cast<PySideSignalInstance*>(%1); QObject* sender = %CONVERTTOCPP[QObject*](PySide::Signal::getObject(signalInstance)); - QSignalTransition *%0 = %CPPSELF->%FUNCTION_NAME(sender, PySide::Signal::getSignature(signalInstance), %2); + QSignalTransition*%0 = %CPPSELF->%FUNCTION_NAME(sender,PySide::Signal::getSignature(signalInstance),%2); %PYARG_0 = %CONVERTTOPYTHON[QSignalTransition*](%0); @@ -4094,12 +4094,12 @@ s1.addTransition(button.clicked, s1h)</code> - + - + @@ -4117,7 +4117,7 @@ s1.addTransition(button.clicked, s1h)</code> - + %PYARG_0 = PyList_New(0); @@ -4144,13 +4144,13 @@ s1.addTransition(button.clicked, s1h)</code> - %PYARG_0 = Shiboken::String::fromFormat("2%s", QMetaObject::normalizedSignature(%1).constData()); + %PYARG_0 = Shiboken::String::fromFormat("2%s",QMetaObject::normalizedSignature(%1).constData()); - %PYARG_0 = Shiboken::String::fromFormat("1%s", QMetaObject::normalizedSignature(%1).constData()); + %PYARG_0 = Shiboken::String::fromFormat("1%s",QMetaObject::normalizedSignature(%1).constData()); @@ -4164,12 +4164,12 @@ s1.addTransition(button.clicked, s1h)</code> - + - + @@ -4193,7 +4193,7 @@ s1.addTransition(button.clicked, s1h)</code> const unsigned char *, const unsigned char *); - + %RETURN_TYPE %0 = %FUNCTION_NAME(%1, reinterpret_cast<uchar*>(PyBytes_AS_STRING(%PYARG_2)), reinterpret_cast<uchar*>(PyBytes_AS_STRING(%PYARG_3)), @@ -4201,7 +4201,7 @@ s1.addTransition(button.clicked, s1h)</code> %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); - + %RETURN_TYPE %0 = %FUNCTION_NAME(%1, reinterpret_cast<uchar*>(PyBytes_AS_STRING(%PYARG_2)), reinterpret_cast<uchar*>(PyBytes_AS_STRING(%PYARG_3)), @@ -4222,7 +4222,7 @@ s1.addTransition(button.clicked, s1h)</code> - + @@ -4250,8 +4250,8 @@ s1.addTransition(button.clicked, s1h)</code> - - + + diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml index 0c43fde1f..976380cda 100644 --- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml +++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml @@ -275,7 +275,7 @@ - + QTransform _result; if (QTransform::quadToQuad(%1, %2, _result)) { @@ -407,7 +407,7 @@ - + if (_i < 0 || _i >= %CPPSELF.count()) { @@ -423,12 +423,12 @@ - - - - + + + + - + @@ -462,7 +462,7 @@ - + @@ -500,7 +500,7 @@ } - + @@ -555,7 +555,7 @@ - + @@ -590,7 +590,7 @@ - + @@ -646,7 +646,7 @@ - + @@ -713,7 +713,7 @@ - + @@ -794,7 +794,7 @@ - + @@ -823,7 +823,7 @@ uchar *ptr = reinterpret_cast<uchar*>(Shiboken::Buffer::getPointer(%PYARG_1)); %0 = new %TYPE(ptr, %ARGS); - + @@ -833,7 +833,7 @@ - + @@ -860,8 +860,8 @@ - - + + @@ -1575,44 +1575,44 @@ - + - + - + - + - + - + - + - + // Clear parent from the old child QStandardItem *_i = %CPPSELF->child(%1, %2); @@ -1625,7 +1625,7 @@ - + // Clear parent from the old child QStandardItem *_i = %CPPSELF->child(%1); @@ -1639,13 +1639,13 @@ - + - + @@ -1666,7 +1666,7 @@ - + @@ -1737,7 +1737,7 @@ - + @@ -1759,7 +1759,7 @@ - + @@ -1911,12 +1911,12 @@ - + - + @@ -1928,7 +1928,7 @@ - + @@ -1951,32 +1951,32 @@ - + - + - + - + - + - + @@ -1993,18 +1993,18 @@ - + - + - + // Clear parent from the old child QStandardItem *_i = %CPPSELF->item(%1, %2); @@ -2017,7 +2017,7 @@ - + // Clear parent from the old child QStandardItem *_i = %CPPSELF->item(%1); @@ -2036,7 +2036,7 @@ - + // Clear parent from the old child QStandardItem *_i = %CPPSELF->verticalHeaderItem(%1); @@ -2062,19 +2062,19 @@ - + - + - + @@ -2110,7 +2110,7 @@ - + @@ -2219,7 +2219,7 @@ - + - + - + - - - - - - + + + + + + - + - + - - + + %BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(%1.data(), %1.size(), %2); %END_ALLOW_THREADS - - + + %BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(%1.data(), %1.size(), %2); %END_ALLOW_THREADS - + - + - + @@ -2295,7 +2295,7 @@ - + @@ -2310,7 +2310,7 @@ - + @@ -3004,7 +3004,7 @@ - + @@ -3035,11 +3035,11 @@ - - + + - - + + if (PySequence_Check(_key)) { @@ -3082,9 +3082,9 @@ - - - + + + @@ -3202,7 +3202,7 @@ This seems to be a related problem with unnamed structures in shiboken. --> - + @@ -3315,7 +3315,7 @@ - + @@ -3633,13 +3633,13 @@ - + - + diff --git a/sources/pyside2/PySide2/QtHelp/typesystem_help.xml b/sources/pyside2/PySide2/QtHelp/typesystem_help.xml index 6bd5dd364..bcaa5fee3 100644 --- a/sources/pyside2/PySide2/QtHelp/typesystem_help.xml +++ b/sources/pyside2/PySide2/QtHelp/typesystem_help.xml @@ -44,7 +44,7 @@ - + diff --git a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml index 8058954a1..ea34e0b02 100644 --- a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml +++ b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml @@ -59,9 +59,9 @@ - + - + @@ -232,7 +232,7 @@ - + @@ -153,18 +153,18 @@ - + - - - - - + + + + + @@ -301,7 +301,7 @@ - + diff --git a/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml b/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml index 38cec3188..9b7adb71a 100644 --- a/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml +++ b/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml @@ -99,7 +99,7 @@ - + @@ -115,7 +115,7 @@ - + @@ -156,7 +156,7 @@ - + @@ -169,7 +169,7 @@ - + @@ -182,7 +182,7 @@ - + @@ -195,7 +195,7 @@ - + @@ -208,7 +208,7 @@ - + @@ -221,7 +221,7 @@ - + @@ -235,7 +235,7 @@ - + @@ -251,7 +251,7 @@ - + @@ -267,7 +267,7 @@ - + @@ -283,7 +283,7 @@ - + @@ -299,7 +299,7 @@ - + @@ -315,7 +315,7 @@ - + @@ -331,7 +331,7 @@ - + @@ -347,7 +347,7 @@ - + @@ -363,7 +363,7 @@ - + @@ -379,7 +379,7 @@ - + @@ -395,7 +395,7 @@ - + @@ -411,7 +411,7 @@ - + @@ -427,7 +427,7 @@ - + @@ -443,7 +443,7 @@ - + @@ -459,7 +459,7 @@ - + @@ -475,7 +475,7 @@ - + @@ -491,7 +491,7 @@ - + @@ -507,7 +507,7 @@ - + @@ -523,7 +523,7 @@ - + @@ -539,7 +539,7 @@ - + @@ -555,7 +555,7 @@ - + @@ -571,7 +571,7 @@ - + @@ -587,7 +587,7 @@ - + @@ -603,7 +603,7 @@ - + @@ -619,7 +619,7 @@ - + @@ -635,7 +635,7 @@ - + @@ -651,7 +651,7 @@ - + @@ -667,7 +667,7 @@ - + @@ -693,8 +693,8 @@ - - + + @@ -703,7 +703,7 @@ - + @@ -730,7 +730,7 @@ } - + @@ -749,7 +749,7 @@ delete[] data; - + diff --git a/sources/pyside2/PySide2/QtPrintSupport/typesystem_printsupport.xml b/sources/pyside2/PySide2/QtPrintSupport/typesystem_printsupport.xml index 24f0de1d8..daf0ed763 100644 --- a/sources/pyside2/PySide2/QtPrintSupport/typesystem_printsupport.xml +++ b/sources/pyside2/PySide2/QtPrintSupport/typesystem_printsupport.xml @@ -50,7 +50,7 @@ - + diff --git a/sources/pyside2/PySide2/QtQml/typesystem_qml.xml b/sources/pyside2/PySide2/QtQml/typesystem_qml.xml index 54431a3af..385383fcc 100644 --- a/sources/pyside2/PySide2/QtQml/typesystem_qml.xml +++ b/sources/pyside2/PySide2/QtQml/typesystem_qml.xml @@ -54,7 +54,7 @@ in generator tests folder. --> - + This function registers the Python type in the QML system with the name qmlName, in the library imported from uri having the version number composed from versionMajor and versionMinor. Returns the QML type id. @@ -123,7 +123,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -192,7 +192,7 @@ - + diff --git a/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml b/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml index 5183ec798..d9373e86d 100644 --- a/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml +++ b/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml @@ -70,7 +70,7 @@ - + diff --git a/sources/pyside2/PySide2/QtSql/typesystem_sql.xml b/sources/pyside2/PySide2/QtSql/typesystem_sql.xml index 2699f29d4..2e7222a16 100644 --- a/sources/pyside2/PySide2/QtSql/typesystem_sql.xml +++ b/sources/pyside2/PySide2/QtSql/typesystem_sql.xml @@ -71,7 +71,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -135,9 +135,9 @@ - + - + diff --git a/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml b/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml index 059abb891..7d11970e7 100644 --- a/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml +++ b/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml @@ -52,7 +52,7 @@ - + @@ -65,7 +65,7 @@ - + diff --git a/sources/pyside2/PySide2/QtTest/typesystem_test.xml b/sources/pyside2/PySide2/QtTest/typesystem_test.xml index c976704b8..ae5e08949 100644 --- a/sources/pyside2/PySide2/QtTest/typesystem_test.xml +++ b/sources/pyside2/PySide2/QtTest/typesystem_test.xml @@ -79,7 +79,7 @@ - + @@ -88,8 +88,8 @@ The problem that costed my days of bug hunting is the fact that shiboken gives misleading error messages. The messages that I could not get rid of were - signature 'generateTouchEvent(QWidget*,QTouchDevice*,bool)' for function modification in 'QTest' not found. Possible candidates: - signature 'generateTouchEvent(QWindow*,QTouchDevice*,bool)' for function modification in 'QTest' not found. Possible candidates: + signature 'generateTouchEvent(QWidget*,QTouchDevice*,bool)' for function modification in 'QTest' not found. Possible candidates: + signature 'generateTouchEvent(QWindow*,QTouchDevice*,bool)' for function modification in 'QTest' not found. Possible candidates: I always thought that for some reason the functions were not recognized, or the arguments somehow do not match their declaration. Only late in the project, I learnt that also @@ -114,32 +114,32 @@ - + - + - + - + - + - + @@ -150,12 +150,12 @@ - + - + diff --git a/sources/pyside2/PySide2/QtUiTools/typesystem_uitools.xml b/sources/pyside2/PySide2/QtUiTools/typesystem_uitools.xml index f6dd0333b..f18b8e818 100644 --- a/sources/pyside2/PySide2/QtUiTools/typesystem_uitools.xml +++ b/sources/pyside2/PySide2/QtUiTools/typesystem_uitools.xml @@ -92,32 +92,32 @@ %CPPSELF.addPluginPath(""); // force reload widgets - + - + - + - + - + @@ -132,7 +132,7 @@ - + diff --git a/sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml b/sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml index 0f8d8da4e..3f51bedbf 100644 --- a/sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml +++ b/sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml @@ -53,7 +53,7 @@ - + @@ -83,7 +83,7 @@ - + @@ -162,7 +162,7 @@ - + - + @@ -291,7 +291,7 @@ - + @@ -299,7 +299,7 @@ - + @@ -435,12 +435,12 @@ - + - + @@ -450,21 +450,21 @@ - + - + - + @@ -672,12 +672,12 @@ - + - + @@ -685,7 +685,7 @@ Shiboken::Object::releaseOwnership(%PYARG_2); - + @@ -761,7 +761,7 @@ - + @@ -772,7 +772,7 @@ - + @@ -809,7 +809,7 @@ - + @@ -835,8 +835,8 @@ - - + + @@ -855,7 +855,7 @@ - + @@ -873,7 +873,7 @@ - + @@ -881,7 +881,7 @@ - + @@ -894,7 +894,7 @@ - + @@ -942,7 +942,7 @@ - + %PYARG_0 = addActionWithPyObject(%CPPSELF, %1, %2); @@ -1006,7 +1006,7 @@ - + @@ -1022,22 +1022,22 @@ - + - + - + - + @@ -1078,22 +1078,22 @@ - + - + - + - + @@ -1110,12 +1110,12 @@ - + - + @@ -1150,12 +1150,12 @@ - + - + @@ -1167,22 +1167,22 @@ - + - + - + - + @@ -1210,14 +1210,14 @@ - + - + - + @@ -1287,7 +1287,7 @@ - + @@ -1305,9 +1305,9 @@ - + - + @@ -1356,12 +1356,12 @@ - + addLayoutOwnership(%CPPSELF, %1); - + addLayoutOwnership(%CPPSELF, %1); @@ -1428,29 +1428,29 @@ - + addLayoutOwnership(%CPPSELF, %1); - + addLayoutOwnership(%CPPSELF, %1); - + addLayoutOwnership(%CPPSELF, %2); - + addLayoutOwnership(%CPPSELF, %2); - + addLayoutOwnership(%CPPSELF, %2); @@ -1469,7 +1469,7 @@ - + @@ -1477,7 +1477,7 @@ addLayoutOwnership(%CPPSELF, %0); - + @@ -1485,7 +1485,7 @@ addLayoutOwnership(%CPPSELF, %1); - + @@ -1493,7 +1493,7 @@ addLayoutOwnership(%CPPSELF, %1); - + @@ -1501,7 +1501,7 @@ addLayoutOwnership(%CPPSELF, %1); - + @@ -1509,7 +1509,7 @@ addLayoutOwnership(%CPPSELF, %1); - + @@ -1562,7 +1562,7 @@ - + @@ -1594,7 +1594,7 @@ - + @@ -1647,7 +1647,7 @@ - + @@ -1657,7 +1657,7 @@ - + @@ -1667,7 +1667,7 @@ - + @@ -1677,7 +1677,7 @@ - + @@ -1687,7 +1687,7 @@ - + @@ -1791,29 +1791,29 @@ - + - + - + - + - + @@ -1823,28 +1823,28 @@ - + - + - + - + - + @@ -1860,7 +1860,7 @@ - + @@ -1915,7 +1915,7 @@ - + @@ -1930,12 +1930,12 @@ - + - + @@ -1992,22 +1992,22 @@ - + - + - + - + @@ -2058,37 +2058,37 @@ - + - + - + - + - + - + - + @@ -2098,12 +2098,12 @@ - + - + @@ -2123,7 +2123,7 @@ - + @@ -2134,7 +2134,7 @@ Shiboken::Object::setParent(%PYARG_0, %PYSELF); - + @@ -2148,7 +2148,7 @@ - + @@ -2158,7 +2158,7 @@ - + @@ -2189,7 +2189,7 @@ - + @@ -2206,7 +2206,7 @@ - + @@ -2416,20 +2416,20 @@ - + - + qwidgetSetLayout(%CPPSELF, %1); // %FUNCTION_NAME() - disable generation of function call. - + @@ -2455,26 +2455,26 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - + @@ -2487,7 +2487,7 @@ - + @@ -2503,27 +2503,27 @@ - + - + - + - + - + @@ -2587,13 +2587,13 @@ - + - + @@ -2621,9 +2621,9 @@ - - - + + + @@ -2635,7 +2635,7 @@ - + @@ -2648,7 +2648,7 @@ - + @@ -2661,7 +2661,7 @@ - + @@ -2674,7 +2674,7 @@ - + @@ -2687,7 +2687,7 @@ - + @@ -2715,7 +2715,7 @@ - + @@ -2756,7 +2756,7 @@ - + @@ -2766,12 +2766,12 @@ - + - + @@ -2791,12 +2791,12 @@ - + - + @@ -2834,12 +2834,12 @@ - + - + @@ -2885,7 +2885,7 @@ - + @@ -2981,19 +2981,19 @@ - + - + - + @@ -3038,7 +3038,7 @@ - + @@ -3114,23 +3114,23 @@ - + - + - + - + @@ -3156,7 +3156,7 @@ - + @@ -3459,7 +3459,7 @@ - + diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_mac.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_mac.xml index a2d665b0a..2dc29f815 100644 --- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_mac.xml +++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_mac.xml @@ -49,7 +49,7 @@ - --> + --> diff --git a/sources/pyside2/PySide2/QtXml/typesystem_xml.xml b/sources/pyside2/PySide2/QtXml/typesystem_xml.xml index d78a1d77c..d5b2ec974 100644 --- a/sources/pyside2/PySide2/QtXml/typesystem_xml.xml +++ b/sources/pyside2/PySide2/QtXml/typesystem_xml.xml @@ -69,7 +69,7 @@ - + @@ -89,7 +89,7 @@ - + @@ -109,7 +109,7 @@ - + @@ -129,7 +129,7 @@ - + @@ -209,7 +209,7 @@ - + @@ -244,7 +244,7 @@ - + @@ -281,7 +281,7 @@ - + @@ -308,7 +308,7 @@ - + diff --git a/sources/pyside2/PySide2/QtXmlPatterns/typesystem_xmlpatterns.xml b/sources/pyside2/PySide2/QtXmlPatterns/typesystem_xmlpatterns.xml index 888595ccc..c597b41d1 100644 --- a/sources/pyside2/PySide2/QtXmlPatterns/typesystem_xmlpatterns.xml +++ b/sources/pyside2/PySide2/QtXmlPatterns/typesystem_xmlpatterns.xml @@ -44,7 +44,7 @@ - + @@ -70,7 +70,7 @@ - + @@ -101,7 +101,7 @@ - + -- cgit v1.2.3 From a861c09fd13d4657191c2d447d7f7d3db5d42d5e Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 11 Apr 2018 13:53:27 +0200 Subject: Fix QtWebEngineProcess related issues on the supported platforms There were 2 issues: 1) QtWebEngineProcess could not be found on Windows because we have a non-standard directory layout for the Qt files we copy over (there is no bin directory), so we need to adjust the internal qt.conf which is set in pyside.cpp 2) QtWebEngineProcess itself does not use the qt.conf from pyside.cpp, because it is a separate executable, and thus we need to supply a qt.conf specifically for it which is placed in the libexec folder. Task-number: PYSIDE-626 Task-number: PYSIDE-631 Task-number: PYSIDE-642 Change-Id: I75d1b083fb5afe5dc31ba90174f42c7f559c5cd5 Reviewed-by: Friedemann Kleint --- sources/pyside2/PySide2/CMakeLists.txt | 19 +++++++++++++++++++ sources/pyside2/PySide2/qt.conf.in | 2 ++ sources/pyside2/libpyside/pyside.cpp | 9 ++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 sources/pyside2/PySide2/qt.conf.in (limited to 'sources/pyside2') diff --git a/sources/pyside2/PySide2/CMakeLists.txt b/sources/pyside2/PySide2/CMakeLists.txt index 971d0a9ef..651bf2734 100644 --- a/sources/pyside2/PySide2/CMakeLists.txt +++ b/sources/pyside2/PySide2/CMakeLists.txt @@ -13,6 +13,25 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/_config.py.in" configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../pyside_version.py" "${CMAKE_CURRENT_BINARY_DIR}/_git_pyside_version.py" @ONLY) +# qt.conf needs to be placed next to QtWebEngineProcess so that the executable uses the correct +# Prefix location leading to an existing icu data file. It is needed on Windows, Linux, and macOS +# non-framework build. In framework build, instead of using qt.conf, Bundle querying is used. +if (WIN32 OR (UNIX AND NOT APPLE) OR (APPLE AND NOT QtCore_is_framework)) + + if (WIN32) + # On Windows, the QtWebEngineProcess is directly located in the Prefix, due to not using + # a "Qt" subfolder like on the other platforms. + set(QT_CONF_PREFIX ".") + else() + # On Linux and non-framework macOS, the QtWebEngineProcess is in ./libexec, so prefix is one + # level higher. + set(QT_CONF_PREFIX "..") + endif() + + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/qt.conf.in" + "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" @ONLY) +endif() + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/__init__.py" "${CMAKE_CURRENT_BINARY_DIR}/support/__init__.py" COPYONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/__init__.py" diff --git a/sources/pyside2/PySide2/qt.conf.in b/sources/pyside2/PySide2/qt.conf.in new file mode 100644 index 000000000..ff5b0a30e --- /dev/null +++ b/sources/pyside2/PySide2/qt.conf.in @@ -0,0 +1,2 @@ +[Paths] +Prefix = @QT_CONF_PREFIX@ diff --git a/sources/pyside2/libpyside/pyside.cpp b/sources/pyside2/libpyside/pyside.cpp index 4c7e6471c..1a59c87e0 100644 --- a/sources/pyside2/libpyside/pyside.cpp +++ b/sources/pyside2/libpyside/pyside.cpp @@ -494,7 +494,14 @@ bool registerInternalQtConf() // rccData needs to be static, otherwise when it goes out of scope, the Qt resource system // will point to invalid memory. - static QByteArray rccData = QByteArray("[Paths]\nPrefix = ") + prefixPath.toLocal8Bit(); + static QByteArray rccData = QByteArray("[Paths]\nPrefix = ") + prefixPath.toLocal8Bit() +#ifdef Q_OS_WIN + // LibraryExecutables needs to point to Prefix instead of ./bin because we don't + // currently conform to the Qt default directory layout on Windows. This is necessary + // for QtWebEngineCore to find the location of QtWebEngineProcess.exe. + + QByteArray("\nLibraryExecutables = ") + prefixPath.toLocal8Bit() +#endif + ; rccData.append('\n'); // The RCC data structure expects a 4-byte size value representing the actual data. -- cgit v1.2.3 From ea7ca4ac8e4ab8adde8c909c0adef90f4341062a Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 11 Apr 2018 18:44:05 +0200 Subject: Add installed package directory to PATH on Windows This makes sure that all shared libraries like plugins and qml plugins are able to find the Qt libraries they depend on. Task-number: PYSIDE-642 Change-Id: I0f54481c089dfdbc69a9098f2768f98b1e7a9a22 Reviewed-by: Friedemann Kleint --- sources/pyside2/PySide2/__init__.py.in | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sources/pyside2') diff --git a/sources/pyside2/PySide2/__init__.py.in b/sources/pyside2/PySide2/__init__.py.in index 4ce266b69..f33b05e31 100644 --- a/sources/pyside2/PySide2/__init__.py.in +++ b/sources/pyside2/PySide2/__init__.py.in @@ -20,10 +20,16 @@ def _setupQtDirectories(): # Used by signature module. os.environ["PYSIDE_PACKAGE_DIR"] = pyside_package_dir - # On Windows add the PySide2\openssl folder (if it exists) to the - # PATH so that the SSL DLLs can be found when Qt tries to dynamically - # load them. Tell Qt to load them and then reset the PATH. if sys.platform == 'win32': + # PATH has to contain the package directory, otherwise plugins + # won't be able to find their required Qt libraries (e.g. the + # svg image plugin won't find Qt5Svg.dll). + os.environ['PATH'] = pyside_package_dir + ";" + os.environ['PATH'] + + # On Windows add the PySide2\openssl folder (if it exists) to + # the PATH so that the SSL DLLs can be found when Qt tries to + # dynamically load them. Tell Qt to load them and then reset + # the PATH. openssl_dir = os.path.join(pyside_package_dir, 'openssl') if os.path.exists(openssl_dir): path = os.environ['PATH'] -- cgit v1.2.3 From 516682fc232db273511440d3c7107ab15f08b5ea Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sun, 18 Mar 2018 11:00:27 +0100 Subject: Add QtWebEngineCore module Change-Id: I8e1127e082abe5978a94aa8a080dfb1d8bbd5952 Reviewed-by: Friedemann Kleint --- sources/pyside2/CMakeLists.txt | 2 +- .../pyside2/PySide2/QtWebEngineCore/CMakeLists.txt | 37 ++++++++++++ .../QtWebEngineCore/typesystem_webenginecore.xml | 69 ++++++++++++++++++++++ .../PySide2/QtWebEngineWidgets/CMakeLists.txt | 1 + .../typesystem_webenginewidgets.xml | 1 + .../pyside2/tests/QtWebEngineCore/CMakeLists.txt | 29 +++++++++ .../QtWebEngineCore/web_engine_custom_scheme.py | 64 ++++++++++++++++++++ 7 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 sources/pyside2/PySide2/QtWebEngineCore/CMakeLists.txt create mode 100644 sources/pyside2/PySide2/QtWebEngineCore/typesystem_webenginecore.xml create mode 100644 sources/pyside2/tests/QtWebEngineCore/CMakeLists.txt create mode 100644 sources/pyside2/tests/QtWebEngineCore/web_engine_custom_scheme.py (limited to 'sources/pyside2') diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt index 41c62c67a..243beabcc 100644 --- a/sources/pyside2/CMakeLists.txt +++ b/sources/pyside2/CMakeLists.txt @@ -340,7 +340,7 @@ endif() if(WIN32) list(APPEND ALL_OPTIONAL_MODULES AxContainer) endif() -list(APPEND ALL_OPTIONAL_MODULES WebChannel WebEngineWidgets WebKit WebKitWidgets WebSockets) +list(APPEND ALL_OPTIONAL_MODULES WebChannel WebEngineCore WebEngineWidgets WebKit WebKitWidgets WebSockets) if (Qt5Core_VERSION VERSION_GREATER 5.9.3) # Depending on fixes in Qt3D list(APPEND ALL_OPTIONAL_MODULES 3DCore 3DRender 3DInput 3DLogic 3DAnimation 3DExtras) endif() diff --git a/sources/pyside2/PySide2/QtWebEngineCore/CMakeLists.txt b/sources/pyside2/PySide2/QtWebEngineCore/CMakeLists.txt new file mode 100644 index 000000000..109b9f208 --- /dev/null +++ b/sources/pyside2/PySide2/QtWebEngineCore/CMakeLists.txt @@ -0,0 +1,37 @@ +project(QtWebEngineCore) + +set(QtWebEngineCore_SRC +${QtWebEngineCore_GEN_DIR}/qwebenginecookiestore_wrapper.cpp +${QtWebEngineCore_GEN_DIR}/qwebenginehttprequest_wrapper.cpp +${QtWebEngineCore_GEN_DIR}/qwebengineurlrequestinfo_wrapper.cpp +${QtWebEngineCore_GEN_DIR}/qwebengineurlrequestinterceptor_wrapper.cpp +${QtWebEngineCore_GEN_DIR}/qwebengineurlrequestjob_wrapper.cpp +${QtWebEngineCore_GEN_DIR}/qwebengineurlschemehandler_wrapper.cpp +# module is always needed +${QtWebEngineCore_GEN_DIR}/qtwebenginecore_module_wrapper.cpp +) + +set(QtWebEngineCore_include_dirs + ${QtWebEngineCore_SOURCE_DIR} + ${QtWebEngineCore_BINARY_DIR} + ${Qt5Core_INCLUDE_DIRS} + ${SHIBOKEN_INCLUDE_DIR} + ${libpyside_SOURCE_DIR} + ${SHIBOKEN_PYTHON_INCLUDE_DIR} + ${QtCore_GEN_DIR} + ) +set(QtWebEngineCore_libraries pyside2 + ${SHIBOKEN_PYTHON_LIBRARIES} + ${SHIBOKEN_LIBRARY} + ${Qt5WebEngineCore_LIBRARIES} + ${Qt5Core_LIBRARIES} + ) +set(QtWebEngineCore_deps QtCore) +create_pyside_module(QtWebEngineCore + QtWebEngineCore_include_dirs + QtWebEngineCore_libraries + QtWebEngineCore_deps + QtWebEngineCore_SOURCE_DIR + QtWebEngineCore_SRC + "") + diff --git a/sources/pyside2/PySide2/QtWebEngineCore/typesystem_webenginecore.xml b/sources/pyside2/PySide2/QtWebEngineCore/typesystem_webenginecore.xml new file mode 100644 index 000000000..5fb064ccb --- /dev/null +++ b/sources/pyside2/PySide2/QtWebEngineCore/typesystem_webenginecore.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sources/pyside2/PySide2/QtWebEngineWidgets/CMakeLists.txt b/sources/pyside2/PySide2/QtWebEngineWidgets/CMakeLists.txt index 32d0643c8..f04394de9 100644 --- a/sources/pyside2/PySide2/QtWebEngineWidgets/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtWebEngineWidgets/CMakeLists.txt @@ -33,6 +33,7 @@ set(QtWebEngineWidgets_include_dirs ${QtWebEngineWidgets_GEN_DIR} ${QtNetwork_GEN_DIR} ${QtWebChannel_GEN_DIR} + ${QtWebEngineCore_GEN_DIR} ) set(QtWebEngineWidgets_libraries pyside2 ${SHIBOKEN_PYTHON_LIBRARIES} diff --git a/sources/pyside2/PySide2/QtWebEngineWidgets/typesystem_webenginewidgets.xml b/sources/pyside2/PySide2/QtWebEngineWidgets/typesystem_webenginewidgets.xml index 9462c3e41..43324e557 100644 --- a/sources/pyside2/PySide2/QtWebEngineWidgets/typesystem_webenginewidgets.xml +++ b/sources/pyside2/PySide2/QtWebEngineWidgets/typesystem_webenginewidgets.xml @@ -45,6 +45,7 @@ + diff --git a/sources/pyside2/tests/QtWebEngineCore/CMakeLists.txt b/sources/pyside2/tests/QtWebEngineCore/CMakeLists.txt new file mode 100644 index 000000000..2e361383c --- /dev/null +++ b/sources/pyside2/tests/QtWebEngineCore/CMakeLists.txt @@ -0,0 +1,29 @@ +############################################################################# +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of PySide2. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## 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 General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## 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-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +PYSIDE_TEST(web_engine_custom_scheme.py) diff --git a/sources/pyside2/tests/QtWebEngineCore/web_engine_custom_scheme.py b/sources/pyside2/tests/QtWebEngineCore/web_engine_custom_scheme.py new file mode 100644 index 000000000..b7c57d8e6 --- /dev/null +++ b/sources/pyside2/tests/QtWebEngineCore/web_engine_custom_scheme.py @@ -0,0 +1,64 @@ +############################################################################# +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of PySide2. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## 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 General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## 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-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +from __future__ import print_function + +import unittest + +from PySide2.QtCore import QBuffer, QTimer +from PySide2.QtWidgets import QApplication +from PySide2.QtWebEngineWidgets import QWebEngineView, QWebEngineProfile +from PySide2.QtWebEngineCore import QWebEngineUrlSchemeHandler + +class TestSchemeHandler(QWebEngineUrlSchemeHandler): + def requestStarted(self, request): + if request.requestUrl() == "testpy:hello": + request.redirect("testpy:goodbye") + return + + self.buffer = QBuffer() + self.buffer.setData("Really nice goodbye text.") + self.buffer.aboutToClose.connect(self.buffer.deleteLater) + request.reply("text/plain;charset=utf-8", self.buffer) + +class MainTest(unittest.TestCase): + def test_SchemeHandlerRedirect(self): + app = QApplication([]) + handler = TestSchemeHandler() + profile = QWebEngineProfile.defaultProfile() + profile.installUrlSchemeHandler("testpy", handler) + view = QWebEngineView() + view.loadFinished.connect(app.quit) + QTimer.singleShot(5000, app.quit) + view.show() + view.load("testpy:hello") + app.exec_() + self.assertEqual(view.url(), "testpy:goodbye") + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.3 From f3e798c4572e308f6f520c6d966ae7f74fe835b7 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 17 Apr 2018 14:12:50 +0200 Subject: Improve qt.conf registration handling When PyInstaller is used to deploy a PySide2 application, it changes the layout of the copied PySide2 files (no Qt subfolder, all shared libraries are copied next to tehe generated executable). In that case using the internal qt.conf won't work. Detect if there a exists a qt.conf file next to the executable, and use that file instead. Note that this won't work when the executable path has unicode characters in conjunction with Python 2 and Windows, but that is an unsupported config anyway (due to the mixing MSVC issue). Also add a logging category to ease figuring out which qt.conf file is used if a need ever arises to do so. Task-number: PYSIDE-642 Change-Id: I1260cbc13e5e62be72c4ed9c64c2aa5905d2e9c6 Reviewed-by: Cristian Maureira-Fredes Reviewed-by: Friedemann Kleint --- sources/pyside2/libpyside/pyside.cpp | 41 +++++++++++++++++++++++++++++++++++- sources/pyside2/libpyside/pyside.h | 3 +++ 2 files changed, 43 insertions(+), 1 deletion(-) (limited to 'sources/pyside2') diff --git a/sources/pyside2/libpyside/pyside.cpp b/sources/pyside2/libpyside/pyside.cpp index 1a59c87e0..51bbb22e1 100644 --- a/sources/pyside2/libpyside/pyside.cpp +++ b/sources/pyside2/libpyside/pyside.cpp @@ -442,6 +442,11 @@ static const unsigned char qt_resource_struct[] = { 0x0,0x0,0x0,0x16,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0 }; +// Note that setting QT_LOGGING_RULES for categories used before QCoreApplication is instantiated, +// will only work on Qt 5.9.4+. On lower versions, it will appear that setting QT_LOGGING_RULES +// does not affect lcPysideQtConf in any way. +Q_LOGGING_CATEGORY(lcPySide2, "pyside2", QtWarningMsg) + bool registerInternalQtConf() { // Guard to ensure single registration. @@ -449,18 +454,49 @@ bool registerInternalQtConf() static bool registrationAttempted = false; #else static bool registrationAttempted = true; + qCDebug(lcPySide2) << "PySide2 was built without qt.conf modification support. " + "No special qt.conf behavior will be applied."; #endif static bool isRegistered = false; if (registrationAttempted) return isRegistered; registrationAttempted = true; + // Support PyInstaller case when a qt.conf file might be provided next to the generated + // PyInstaller executable. + // This will disable the internal qt.conf which points to the PySide2 subdirectory (due to the + // subdirectory not existing anymore). + QString executablePath = +#if PY_MAJOR_VERSION >= 3 + QString::fromWCharArray(Py_GetProgramFullPath()); +#else + // Python 2 unfortunately returns a char* array instead of a wchar*, which means that on + // Windows if the executable path contains unicode characters, the returned path will be + // invalid. We can't use QCoreApplication::applicationFilePath because it requires an + // existing QCoreApplication instance despite being a static method. + // This means that a qt.conf near an executable won't be picked up correctly on + // Windows + Python 2. + QString::fromLocal8Bit(Py_GetProgramFullPath()); +#endif + QString appDirPath = QFileInfo(executablePath).absolutePath(); + QString maybeQtConfPath = QDir(appDirPath).filePath(QStringLiteral("qt.conf")); + bool executableQtConfAvailable = QFileInfo::exists(maybeQtConfPath); + maybeQtConfPath = QDir::toNativeSeparators(maybeQtConfPath); + if (!executableQtConfAvailable) { + qCDebug(lcPySide2) << "No qt.conf found near executable at: " << maybeQtConfPath + << "\nTrying next candidates."; + } + // Allow disabling the usage of the internal qt.conf. This is necessary for tests to work, // because tests are executed before the package is installed, and thus the Prefix specified // in qt.conf would point to a not yet existing location. bool disableInternalQtConf = qEnvironmentVariableIntValue("PYSIDE_DISABLE_INTERNAL_QT_CONF") > 0 ? true : false; - if (disableInternalQtConf) { + if (disableInternalQtConf || executableQtConfAvailable) { + if (executableQtConfAvailable) + qCDebug(lcPySide2) << "Using qt.conf found near executable at: " << maybeQtConfPath; + if (disableInternalQtConf) + qCDebug(lcPySide2) << "Internal qt.conf usage disabled via environment variable."; registrationAttempted = true; return false; } @@ -517,6 +553,9 @@ bool registerInternalQtConf() reinterpret_cast( rccData.constData())); + if (isRegistered) + qCDebug(lcPySide2) << "Using internal qt.conf with prefix pointing to: " << prefixPath; + return isRegistered; } diff --git a/sources/pyside2/libpyside/pyside.h b/sources/pyside2/libpyside/pyside.h index becb92208..d36965d7b 100644 --- a/sources/pyside2/libpyside/pyside.h +++ b/sources/pyside2/libpyside/pyside.h @@ -50,6 +50,7 @@ #include #include #include +#include struct SbkObjectType; @@ -163,6 +164,8 @@ PYSIDE_API QString pyStringToQString(PyObject *str); */ PYSIDE_API bool registerInternalQtConf(); +Q_DECLARE_LOGGING_CATEGORY(lcPySide2) + } //namespace PySide -- cgit v1.2.3 From 186b40b958aa1ebe7317ccf5de7109a327b5c65d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 20 Apr 2018 08:39:24 +0200 Subject: Add QtSensors Task-number: PYSIDE-487 Change-Id: Id60f3f6e70b4fbb8e4316b994cdd557ff9be7b3b Reviewed-by: Alexandru Croitor --- sources/pyside2/CMakeLists.txt | 2 +- sources/pyside2/PySide2/QtSensors/CMakeLists.txt | 106 +++++++++++++++++ .../PySide2/QtSensors/typesystem_sensors.xml | 127 +++++++++++++++++++++ sources/pyside2/tests/QtSensors/CMakeLists.txt | 1 + sources/pyside2/tests/QtSensors/sensors.py | 55 +++++++++ 5 files changed, 290 insertions(+), 1 deletion(-) create mode 100644 sources/pyside2/PySide2/QtSensors/CMakeLists.txt create mode 100644 sources/pyside2/PySide2/QtSensors/typesystem_sensors.xml create mode 100644 sources/pyside2/tests/QtSensors/CMakeLists.txt create mode 100644 sources/pyside2/tests/QtSensors/sensors.py (limited to 'sources/pyside2') diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt index 243beabcc..5bd22d62c 100644 --- a/sources/pyside2/CMakeLists.txt +++ b/sources/pyside2/CMakeLists.txt @@ -330,7 +330,7 @@ if(APPLE) endif() # Collect all optional modules. -set(ALL_OPTIONAL_MODULES Xml XmlPatterns Help Multimedia MultimediaWidgets OpenGL Qml Quick QuickWidgets Script ScriptTools TextToSpeech Charts Svg DataVisualization) +set(ALL_OPTIONAL_MODULES Xml XmlPatterns Help Multimedia MultimediaWidgets OpenGL Qml Quick QuickWidgets Script ScriptTools Sensors TextToSpeech Charts Svg DataVisualization) find_package(Qt5UiTools) if(Qt5UiTools_FOUND) list(APPEND ALL_OPTIONAL_MODULES UiTools) diff --git a/sources/pyside2/PySide2/QtSensors/CMakeLists.txt b/sources/pyside2/PySide2/QtSensors/CMakeLists.txt new file mode 100644 index 000000000..226625443 --- /dev/null +++ b/sources/pyside2/PySide2/QtSensors/CMakeLists.txt @@ -0,0 +1,106 @@ +project(QtSensors) + +set(QtSensors_OPTIONAL_SRC ) +set(QtSensors_DROPPED_ENTRIES ) + +set(QtSensors_SRC +# overrides QObject::metaObject() by private method +# ${QtSensors_GEN_DIR}/qsensorgesture_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorgesturemanager_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorgestureplugininterface_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorgesturerecognizer_wrapper.cpp + ${QtSensors_GEN_DIR}/qaccelerometer_wrapper.cpp + ${QtSensors_GEN_DIR}/qaccelerometerfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qaccelerometerreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qaltimeter_wrapper.cpp + ${QtSensors_GEN_DIR}/qaltimeterfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qaltimeterreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qambientlightfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qambientlightreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qambientlightsensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qambienttemperaturefilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qambienttemperaturereading_wrapper.cpp + ${QtSensors_GEN_DIR}/qambienttemperaturesensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qcompass_wrapper.cpp + ${QtSensors_GEN_DIR}/qcompassfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qcompassreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qdistancefilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qdistancereading_wrapper.cpp + ${QtSensors_GEN_DIR}/qdistancesensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qgyroscope_wrapper.cpp + ${QtSensors_GEN_DIR}/qgyroscopefilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qgyroscopereading_wrapper.cpp + ${QtSensors_GEN_DIR}/qholsterfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qholsterreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qholstersensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qhumidityfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qhumidityreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qhumiditysensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qirproximityfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qirproximityreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qirproximitysensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qlidfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qlidreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qlidsensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qlightfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qlightreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qlightsensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qmagnetometer_wrapper.cpp + ${QtSensors_GEN_DIR}/qmagnetometerfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qmagnetometerreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qorientationfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qorientationreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qorientationsensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qpressurefilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qpressurereading_wrapper.cpp + ${QtSensors_GEN_DIR}/qpressuresensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qproximityfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qproximityreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qproximitysensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qrotationfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qrotationreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qrotationsensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qoutputrange_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorbackend_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorbackendfactory_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensormanager_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorchangesinterface_wrapper.cpp + ${QtSensors_GEN_DIR}/qsensorplugininterface_wrapper.cpp + ${QtSensors_GEN_DIR}/qtapfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qtapreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qtapsensor_wrapper.cpp + ${QtSensors_GEN_DIR}/qtiltfilter_wrapper.cpp + ${QtSensors_GEN_DIR}/qtiltreading_wrapper.cpp + ${QtSensors_GEN_DIR}/qtiltsensor_wrapper.cpp +# module is always needed + ${QtSensors_GEN_DIR}/qtsensors_module_wrapper.cpp +) + +set(QtSensors_include_dirs ${QtSensors_SOURCE_DIR} + ${QtSensors_BINARY_DIR} + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Sensors_INCLUDE_DIRS} + ${SHIBOKEN_INCLUDE_DIR} + ${libpyside_SOURCE_DIR} + ${SHIBOKEN_PYTHON_INCLUDE_DIR} + ${QtCore_GEN_DIR}) + +set(QtSensors_libraries pyside2 + ${SHIBOKEN_PYTHON_LIBRARIES} + ${SHIBOKEN_LIBRARY} + ${Qt5Sensors_LIBRARIES}) + +set(QtSensors_deps QtCore) + +create_pyside_module(QtSensors + QtSensors_include_dirs + QtSensors_libraries + QtSensors_deps + QtSensors_SOURCE_DIR + QtSensors_SRC + "" + "" + QtSensors_DROPPED_ENTRIES) diff --git a/sources/pyside2/PySide2/QtSensors/typesystem_sensors.xml b/sources/pyside2/PySide2/QtSensors/typesystem_sensors.xml new file mode 100644 index 000000000..45d64e0a2 --- /dev/null +++ b/sources/pyside2/PySide2/QtSensors/typesystem_sensors.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sources/pyside2/tests/QtSensors/CMakeLists.txt b/sources/pyside2/tests/QtSensors/CMakeLists.txt new file mode 100644 index 000000000..87e548f87 --- /dev/null +++ b/sources/pyside2/tests/QtSensors/CMakeLists.txt @@ -0,0 +1 @@ +PYSIDE_TEST(sensors.py) diff --git a/sources/pyside2/tests/QtSensors/sensors.py b/sources/pyside2/tests/QtSensors/sensors.py new file mode 100644 index 000000000..5b41ac63d --- /dev/null +++ b/sources/pyside2/tests/QtSensors/sensors.py @@ -0,0 +1,55 @@ +#!/usr/bin/python + +############################################################################# +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of PySide2. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## 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 General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## 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-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +'''Test cases for QSensor''' + +from PySide2.QtSensors import QSensor, QSensorReading +import unittest + +class QSensorTest(unittest.TestCase): + def test(self): + for sensorType in QSensor.sensorTypes(): + identifiers = QSensor.sensorsForType(sensorType) + values = [] + usedIdentifier = None + for identifier in identifiers: + sensor = QSensor(sensorType, None); + sensor.setIdentifier(identifier) + if sensor.connectToBackend(): + usedIdentifier = identifier + reading = sensor.reading() + for i in range(0, reading.valueCount()): + values.append(reading.value(i)) + break + if usedIdentifier: + print('Sensor ', sensorType, usedIdentifier, values) + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.3 From 77a433f80ea32f19507f0992b96aacf481a43304 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 20 Apr 2018 15:42:20 +0200 Subject: QWebEngineDownloadItem: Add enum SavePageFormat Task-number: PYSIDE-487 Change-Id: Ia4b57f4cdc48741ed7659018a742bbda3824c188 Reviewed-by: Alexandru Croitor --- .../pyside2/PySide2/QtWebEngineWidgets/typesystem_webenginewidgets.xml | 1 + 1 file changed, 1 insertion(+) (limited to 'sources/pyside2') diff --git a/sources/pyside2/PySide2/QtWebEngineWidgets/typesystem_webenginewidgets.xml b/sources/pyside2/PySide2/QtWebEngineWidgets/typesystem_webenginewidgets.xml index 43324e557..41c8afcfe 100644 --- a/sources/pyside2/PySide2/QtWebEngineWidgets/typesystem_webenginewidgets.xml +++ b/sources/pyside2/PySide2/QtWebEngineWidgets/typesystem_webenginewidgets.xml @@ -54,6 +54,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sources/pyside2/PySide2/QtPositioning/CMakeLists.txt b/sources/pyside2/PySide2/QtPositioning/CMakeLists.txt new file mode 100644 index 000000000..3a2eb9cf5 --- /dev/null +++ b/sources/pyside2/PySide2/QtPositioning/CMakeLists.txt @@ -0,0 +1,55 @@ +project(QtPositioning) + +set(QtPositioning_OPTIONAL_SRC ) +set(QtPositioning_DROPPED_ENTRIES ) + +set(QtPositioning_SRC +${QtPositioning_GEN_DIR}/qgeoaddress_wrapper.cpp +${QtPositioning_GEN_DIR}/qgeoareamonitorinfo_wrapper.cpp +${QtPositioning_GEN_DIR}/qgeoareamonitorsource_wrapper.cpp +${QtPositioning_GEN_DIR}/qgeolocation_wrapper.cpp +${QtPositioning_GEN_DIR}/qgeocircle_wrapper.cpp +${QtPositioning_GEN_DIR}/qgeocoordinate_wrapper.cpp +${QtPositioning_GEN_DIR}/qgeopath_wrapper.cpp +${QtPositioning_GEN_DIR}/qgeopositioninfo_wrapper.cpp +${QtPositioning_GEN_DIR}/qgeopositioninfosource_wrapper.cpp +${QtPositioning_GEN_DIR}/qgeopositioninfosourcefactory_wrapper.cpp +${QtPositioning_GEN_DIR}/qgeorectangle_wrapper.cpp +${QtPositioning_GEN_DIR}/qgeosatelliteinfo_wrapper.cpp +${QtPositioning_GEN_DIR}/qgeosatelliteinfosource_wrapper.cpp +${QtPositioning_GEN_DIR}/qgeoshape_wrapper.cpp +${QtPositioning_GEN_DIR}/qnmeapositioninfosource_wrapper.cpp +# module is always needed +${QtPositioning_GEN_DIR}/qtpositioning_module_wrapper.cpp +) + +if (Qt5Positioning_VERSION VERSION_EQUAL 5.10.0 OR Qt5Positioning_VERSION VERSION_GREATER 5.10.0) + list(APPEND QtPositioning_SRC + ${QtPositioning_GEN_DIR}/qgeopolygon_wrapper.cpp) +endif() + +set(QtPositioning_include_dirs ${QtPositioning_SOURCE_DIR} + ${QtPositioning_BINARY_DIR} + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Positioning_INCLUDE_DIRS} + ${SHIBOKEN_INCLUDE_DIR} + ${libpyside_SOURCE_DIR} + ${SHIBOKEN_PYTHON_INCLUDE_DIR} + ${QtCore_GEN_DIR}) + +set(QtPositioning_libraries pyside2 + ${SHIBOKEN_PYTHON_LIBRARIES} + ${SHIBOKEN_LIBRARY} + ${Qt5Positioning_LIBRARIES}) + +set(QtPositioning_deps QtCore) + +create_pyside_module(QtPositioning + QtPositioning_include_dirs + QtPositioning_libraries + QtPositioning_deps + QtPositioning_SOURCE_DIR + QtPositioning_SRC + "" + "" + QtPositioning_DROPPED_ENTRIES) diff --git a/sources/pyside2/PySide2/QtPositioning/typesystem_positioning.xml b/sources/pyside2/PySide2/QtPositioning/typesystem_positioning.xml new file mode 100644 index 000000000..058994ad0 --- /dev/null +++ b/sources/pyside2/PySide2/QtPositioning/typesystem_positioning.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sources/pyside2/tests/QtLocation/CMakeLists.txt b/sources/pyside2/tests/QtLocation/CMakeLists.txt new file mode 100644 index 000000000..b97ac1098 --- /dev/null +++ b/sources/pyside2/tests/QtLocation/CMakeLists.txt @@ -0,0 +1 @@ +PYSIDE_TEST(location.py) diff --git a/sources/pyside2/tests/QtLocation/location.py b/sources/pyside2/tests/QtLocation/location.py new file mode 100644 index 000000000..ca964c46c --- /dev/null +++ b/sources/pyside2/tests/QtLocation/location.py @@ -0,0 +1,41 @@ +############################################################################# +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of PySide2. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## 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 General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## 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-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +'''Unit test for Location''' + +from PySide2.QtLocation import QGeoServiceProvider +import unittest + +class QLocationTestCase(unittest.TestCase): + def test(self): + geoServiceProvider = QGeoServiceProvider("none") + self.assertEqual(geoServiceProvider.errorString(), + 'The geoservices provider none is not supported.') + +if __name__ == "__main__": + unittest.main() diff --git a/sources/pyside2/tests/QtPositioning/CMakeLists.txt b/sources/pyside2/tests/QtPositioning/CMakeLists.txt new file mode 100644 index 000000000..b9f7631b1 --- /dev/null +++ b/sources/pyside2/tests/QtPositioning/CMakeLists.txt @@ -0,0 +1 @@ +PYSIDE_TEST(positioning.py) diff --git a/sources/pyside2/tests/QtPositioning/positioning.py b/sources/pyside2/tests/QtPositioning/positioning.py new file mode 100644 index 000000000..9f61fe1ef --- /dev/null +++ b/sources/pyside2/tests/QtPositioning/positioning.py @@ -0,0 +1,43 @@ +############################################################################# +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of PySide2. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## 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 General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## 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-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +'''Unit test for Positioning''' + +from PySide2.QtPositioning import QGeoPositionInfoSource +import unittest + +class QPositioningTestCase(unittest.TestCase): + def test(self): + source = QGeoPositionInfoSource.createDefaultSource(None) + self.assertTrue(source is not None) + name = source.sourceName() + print('QtPositioning source: {}'.format(name)) + self.assertTrue(name) + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3