diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-10 12:42:25 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-10 12:45:26 +0200 |
commit | d4bc1ade3a8aae42915c1c71f4bac10414644ae0 (patch) | |
tree | 94496a73808d58db1505a4034a4eedc0c8a3930d /sources/pyside2 | |
parent | 8f7de769636f36bcf371c472480adab75a32e0bf (diff) | |
parent | 074e52bccfba94c97cc132060e7087f830756b26 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I8a627fd459c3f9601d078a00d3d77c8b3fe04304
Diffstat (limited to 'sources/pyside2')
7 files changed, 117 insertions, 3 deletions
diff --git a/sources/pyside2/PySide2/QtWinExtras/CMakeLists.txt b/sources/pyside2/PySide2/QtWinExtras/CMakeLists.txt index 3593394c3..6c877dfe4 100644 --- a/sources/pyside2/PySide2/QtWinExtras/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtWinExtras/CMakeLists.txt @@ -18,21 +18,27 @@ ${QtWinExtras_GEN_DIR}/qwinthumbnailtoolbutton_wrapper.cpp ${QtWinExtras_GEN_DIR}/qtwinextras_module_wrapper.cpp ) +configure_file("${QtWinExtras_SOURCE_DIR}/QtWinExtras_global.pre.h.in" + "${QtWinExtras_BINARY_DIR}/QtWinExtras_global.pre.h" @ONLY) + set(QtWinExtras_include_dirs ${QtWinExtras_SOURCE_DIR} ${QtWinExtras_BINARY_DIR} ${Qt${QT_MAJOR_VERSION}WinExtras_INCLUDE_DIRS} ${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS} ${Qt${QT_MAJOR_VERSION}Gui_INCLUDE_DIRS} + ${Qt${QT_MAJOR_VERSION}Widgets_INCLUDE_DIRS} ${QtCore_GEN_DIR} ${QtGui_GEN_DIR} + ${QtWidgets_GEN_DIR} ${libpyside_SOURCE_DIR}) set(QtWinExtras_libraries pyside2 ${Qt${QT_MAJOR_VERSION}WinExtras_LIBRARIES} ${Qt${QT_MAJOR_VERSION}Core_LIBRARIES} - ${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES}) + ${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES} + ${Qt${QT_MAJOR_VERSION}Widgets_LIBRARIES}) -set(QtWinExtras_deps QtCore QtGui) +set(QtWinExtras_deps QtCore QtGui QtWidgets) create_pyside_module(NAME QtWinExtras INCLUDE_DIRS QtWinExtras_include_dirs diff --git a/sources/pyside2/PySide2/QtWinExtras/QtWinExtras_global.pre.h.in b/sources/pyside2/PySide2/QtWinExtras/QtWinExtras_global.pre.h.in new file mode 100644 index 000000000..21285e301 --- /dev/null +++ b/sources/pyside2/PySide2/QtWinExtras/QtWinExtras_global.pre.h.in @@ -0,0 +1,5 @@ +// QT_WIDGETS_LIB must be defined for the widget functions to become visible. + +#if @Qt6Widgets_FOUND@ +# define QT_WIDGETS_LIB +#endif diff --git a/sources/pyside2/PySide2/QtWinExtras/typesystem_winextras.xml b/sources/pyside2/PySide2/QtWinExtras/typesystem_winextras.xml index db7416a24..69c90dd34 100644 --- a/sources/pyside2/PySide2/QtWinExtras/typesystem_winextras.xml +++ b/sources/pyside2/PySide2/QtWinExtras/typesystem_winextras.xml @@ -42,6 +42,7 @@ <typesystem package="PySide2.QtWinExtras"> <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/> <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/> + <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/> <namespace-type name="QtWin"> <enum-type name="HBitmapFormat"/> diff --git a/sources/pyside2/PySide2/QtXml/typesystem_xml.xml b/sources/pyside2/PySide2/QtXml/typesystem_xml.xml index e1750fb80..96d12ea4e 100644 --- a/sources/pyside2/PySide2/QtXml/typesystem_xml.xml +++ b/sources/pyside2/PySide2/QtXml/typesystem_xml.xml @@ -231,7 +231,20 @@ <object-type name="QXmlNamespaceSupport"/> - <value-type name="QDomElement"/> + <value-type name="QDomElement"> + <!-- PYSIDE-1372 + We will leave only one for int, and one for float since Python + doesn't have other variations on the primitive types. + Only 'qlonglong' and 'double' will be available from the Qt API. + TODO: This will require a better review of the shiboken primitive + types converters, since this situation might happen on + different signatures. + --> + <modify-function signature="setAttribute(const QString&, uint)" remove="all"/> + <modify-function signature="setAttribute(const QString&, float)" remove="all"/> + <modify-function signature="setAttribute(const QString&, int)" remove="all"/> + <modify-function signature="setAttribute(const QString&, qulonglong)" remove="all"/> + </value-type> <object-type name="QXmlContentHandler"> <modify-function signature="setDocumentLocator(QXmlLocator*)"> diff --git a/sources/pyside2/doc/considerations.rst b/sources/pyside2/doc/considerations.rst index f05d929b5..b5eae7d86 100644 --- a/sources/pyside2/doc/considerations.rst +++ b/sources/pyside2/doc/considerations.rst @@ -133,3 +133,17 @@ Abandoned Alternative We also tried an alternative implementation with a ``qApp()`` function that was more *pythonic* and problem free, but many people liked the ``qApp`` macro better for its brevity, so here it is. + + +Rich Comparison +~~~~~~~~~~~~~~~ + +There was a long-standing bug in the ``tp_richcompare`` implementation of PySide classes. + +* When a class did not implement it, the default implementation of ``object`` is used. + This implements ``==`` and ``!=`` like the ``is`` operator. + +* When a class implements only a single function like ``<``, then the default implementation + was disabled, and expressions like ``obj in sequence`` failed with ``NotImplemented``. + +This oversight was fixed in version 5.15.1 . diff --git a/sources/pyside2/tests/QtWidgets/CMakeLists.txt b/sources/pyside2/tests/QtWidgets/CMakeLists.txt index 33bff6fed..afa5eae0a 100644 --- a/sources/pyside2/tests/QtWidgets/CMakeLists.txt +++ b/sources/pyside2/tests/QtWidgets/CMakeLists.txt @@ -122,6 +122,7 @@ PYSIDE_TEST(qtextedit_test.py) PYSIDE_TEST(qtextedit_signal_test.py) PYSIDE_TEST(qtreeview_test.py) PYSIDE_TEST(qtreewidget_test.py) +PYSIDE_TEST(qtreewidgetitem_test.py) PYSIDE_TEST(qtoolbar_test.py) PYSIDE_TEST(qtoolbox_test.py) PYSIDE_TEST(qvariant_test.py) diff --git a/sources/pyside2/tests/QtWidgets/qtreewidgetitem_test.py b/sources/pyside2/tests/QtWidgets/qtreewidgetitem_test.py new file mode 100644 index 000000000..115bce4b7 --- /dev/null +++ b/sources/pyside2/tests/QtWidgets/qtreewidgetitem_test.py @@ -0,0 +1,74 @@ +#!/usr/bin/python + +############################################################################# +## +## Copyright (C) 2020 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 tests for QTreeWidgetItem +------------------------------ + +This test is actually meant for all types which provide `tp_richcompare` +but actually define something without providing `==` or `!=` operators. +QTreeWidgetItem for instance defines `<` only. + +PYSIDE-74: We redirect to type `object`s handling which is anyway the default + when `tp_richcompare` is undefined. +""" + +import os +import sys +import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from init_paths import init_test_paths +init_test_paths(False) + +from PySide2 import QtCore, QtWidgets + + +class QTreeWidgetItemTest(unittest.TestCase): + def testClass(self): + app = QtWidgets.QApplication([]) + treewidget = QtWidgets.QTreeWidget() + item = QtWidgets.QTreeWidgetItem(["Words and stuff"]) + item2 = QtWidgets.QTreeWidgetItem(["More words!"]) + treewidget.insertTopLevelItem(0, item) + + dummy_list = ["Numbers", "Symbols", "Spam"] + self.assertFalse(item in dummy_list) + self.assertTrue(item not in dummy_list) + self.assertFalse(item == item2) + self.assertTrue(item != item2) + treewidget.show() + QtCore.QTimer.singleShot(500, app.quit) + app.exec_() + + +if __name__ == "__main__": + unittest.main() + |