diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-02-02 13:55:01 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-02-02 13:55:01 +0100 |
commit | 4b2ef72f0461fbce539d6a1bd69d8c0ed7041025 (patch) | |
tree | 6b311ffa86655f7c27aca88df59d125070bc32fb /sources | |
parent | a5bc27c463f40f6c984f99f81bb05e46699c7df1 (diff) | |
parent | a18e81dd1311811eb1227cf46d253ae647a9fbdd (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.9
Change-Id: I777970f7bb17db766660d82556559eadd7293355
Diffstat (limited to 'sources')
5 files changed, 79 insertions, 4 deletions
diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml index 92ff3c08b..d0c4877f2 100644 --- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml +++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml @@ -2526,10 +2526,13 @@ </modify-function> <modify-function signature="clear()"> <inject-code class="target" position="beginning"> + Shiboken::BindingManager& bm = Shiboken::BindingManager::instance(); for (int i = 0; i < %CPPSELF.count(); i++) { QWidget* widget = %CPPSELF.widget(i); - Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](widget)); - Shiboken::Object::setParent(0, pyWidget); + if (bm.hasWrapper(widget)) { + Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](widget)); + Shiboken::Object::releaseOwnership(pyWidget); + } } %CPPSELF.%FUNCTION_NAME(); </inject-code> diff --git a/sources/pyside2/cmake/Macros/PySideModules.cmake b/sources/pyside2/cmake/Macros/PySideModules.cmake index 83d43976a..36488912d 100644 --- a/sources/pyside2/cmake/Macros/PySideModules.cmake +++ b/sources/pyside2/cmake/Macros/PySideModules.cmake @@ -174,16 +174,22 @@ macro(check_qt_class module class optional_source_files dropped_entries) "int main() { sizeof(${class}); }\n" ) + # Because Qt is built with -fPIC (by default), the compile tests also have to have that. + get_property(ADDITIONAL_FLAGS TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_OPTIONS) + + # Don't add version tagging, because for some reason linker fails with: + # (.qtversion[qt_version_tag]+0x0): undefined reference to `qt_version_tag' # Force usage of the C++11 standard. CMAKE_CXX_STANDARD does not work with try_compile # but the issue has a fix in CMake 3.9. Thus we use a terrible workaround, we pass the C++ # standard flag the way CheckCXXSourceCompiles.cmake does it. - set(CUSTOM_CPP_STANDARD ${CMAKE_CXX11_EXTENSION_COMPILE_OPTION}) + + set(ADDITIONAL_FLAGS "${ADDITIONAL_FLAGS} -DQT_NO_VERSION_TAGGING ${CMAKE_CXX11_EXTENSION_COMPILE_OPTION}") try_compile(Q_WORKS ${CMAKE_BINARY_DIR} ${SRC_FILE} CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${QT_INCLUDE_DIR};${Qt5${_module_no_qt_prefix}_INCLUDE_DIRS}" - "-DCOMPILE_DEFINITIONS:STRING=${CUSTOM_CPP_STANDARD}" + "-DCOMPILE_DEFINITIONS:STRING=${ADDITIONAL_FLAGS}" OUTPUT_VARIABLE OUTPUT) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCheckQtClassTest.log ${OUTPUT}) diff --git a/sources/pyside2/tests/QtWidgets/CMakeLists.txt b/sources/pyside2/tests/QtWidgets/CMakeLists.txt index 60a1d7d6f..af3a476b1 100644 --- a/sources/pyside2/tests/QtWidgets/CMakeLists.txt +++ b/sources/pyside2/tests/QtWidgets/CMakeLists.txt @@ -117,6 +117,7 @@ PYSIDE_TEST(qstring_qkeysequence_test.py) PYSIDE_TEST(qstyle_test.py) PYSIDE_TEST(qtableview_test.py) PYSIDE_TEST(qtabwidget_test.py) +PYSIDE_TEST(qtabwidgetclear_test.py) PYSIDE_TEST(qtextedit_test.py) PYSIDE_TEST(qtextedit_signal_test.py) PYSIDE_TEST(qtoolbar_test.py) diff --git a/sources/pyside2/tests/QtWidgets/qtabwidgetclear_test.py b/sources/pyside2/tests/QtWidgets/qtabwidgetclear_test.py new file mode 100644 index 000000000..8e9b36fab --- /dev/null +++ b/sources/pyside2/tests/QtWidgets/qtabwidgetclear_test.py @@ -0,0 +1,63 @@ +############################################################################# +## +## 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 QMainWindow, QTabWidget, QTextEdit, QSplitter +from helper import UsesQApplication + +class TabWidgetClear(QMainWindow): + def __init__(self): + QMainWindow.__init__(self) + self.tabWidget = QTabWidget(self) + self.setCentralWidget(self.tabWidget) + self.editBox = QTextEdit(self) + self.tabWidget.addTab(self.getSplitter(), 'Test') + + def getSplitter(self): + splitter = QSplitter() + splitter.addWidget(self.editBox) + return splitter + + def toggle(self): + self.tabWidget.clear() + self.getSplitter() + +class TestTabWidgetClear(UsesQApplication): + + def testClear(self): + self.window = TabWidgetClear() + self.window.show() + try: + self.window.toggle() + except RuntimeError as e: + # This should never happened, PYSIDE-213 + raise e + +if __name__ == '__main__': + unittest.main() diff --git a/sources/shiboken2/libshiboken/signature.cpp b/sources/shiboken2/libshiboken/signature.cpp index a2cd12a87..2b1447140 100644 --- a/sources/shiboken2/libshiboken/signature.cpp +++ b/sources/shiboken2/libshiboken/signature.cpp @@ -632,6 +632,7 @@ SbkSpecial_Type_Ready(PyObject *module, PyTypeObject *type, return ret; } +#if EXTENSION_ENABLED static int PySide_FinishSignatures(PyObject *module, const char *signatures) { @@ -675,6 +676,7 @@ PySide_FinishSignatures(PyObject *module, const char *signatures) #endif return 0; } +#endif // EXTENSION_ENABLED void FinishSignatureInitialization(PyObject *module, const char *signatures) |