diff options
-rw-r--r-- | setup.py | 30 | ||||
-rw-r--r-- | sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml | 7 | ||||
-rw-r--r-- | sources/pyside2/cmake/Macros/PySideModules.cmake | 10 | ||||
-rw-r--r-- | sources/pyside2/tests/QtWidgets/CMakeLists.txt | 1 | ||||
-rw-r--r-- | sources/pyside2/tests/QtWidgets/qtabwidgetclear_test.py | 63 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/signature.cpp | 2 |
6 files changed, 101 insertions, 12 deletions
@@ -42,10 +42,10 @@ from distutils.version import LooseVersion """This is a distutils setup-script for the PySide2 project -To build the PySide2, simply execute: - python setup.py build --qmake=</path/to/qt/bin/qmake> [--cmake=</path/to/cmake>] [--openssl=</path/to/openssl/bin>] +To build PySide2 simply execute: + python setup.py build --qmake=</path/to/qt/bin/qmake> [--cmake=</path/to/cmake>] [only Windows --openssl=</path/to/openssl/bin>] or - python setup.py install --qmake=</path/to/qt/bin/qmake> [--cmake=</path/to/cmake>] [--openssl=</path/to/openssl/bin>] + python setup.py install --qmake=</path/to/qt/bin/qmake> [--cmake=</path/to/cmake>] [only Windows --openssl=</path/to/openssl/bin>] to build and install into your current Python installation. On Linux and macOS you can use option --standalone, to embed Qt libraries into the PySide2 package. @@ -59,10 +59,10 @@ option is not specified. You can use option --only-package, if you want to create more binary packages (bdist_wheel, bdist_egg, ...) without rebuilding entire PySide2 every time: # First time we create bdist_wheel with full PySide2 build - python setup.py bdist_wheel --qmake=c:\Qt\4.8.5\bin\qmake.exe --cmake=c:\tools\cmake\bin\cmake.exe --openssl=c:\libs\OpenSSL32bit\bin + python setup.py bdist_wheel --qmake=c:\Qt\5.6\bin\qmake.exe --cmake=c:\tools\cmake\bin\cmake.exe --openssl=c:\libs\OpenSSL32bit\bin # Then we create bdist_egg reusing PySide2 build with option --only-package - python setup.py bdist_egg --only-package --qmake=c:\Qt\4.8.5\bin\qmake.exe --cmake=c:\tools\cmake\bin\cmake.exe --opnessl=c:\libs\OpenSSL32bit\bin + python setup.py bdist_egg --only-package --qmake=c:\Qt\5.6\bin\qmake.exe --cmake=c:\tools\cmake\bin\cmake.exe --opnessl=c:\libs\OpenSSL32bit\bin You can use the option --qt-conf-prefix to pass a path relative to the PySide2 installed package, which will be embedded into an auto-generated qt.conf registered in the Qt resource system. This @@ -88,8 +88,21 @@ REQUIREMENTS: - Qt: 5.5 and 5.6 are supported. Specify the path to qmake with --qmake option or add qmake to the system path. OPTIONAL: -OpenSSL: You can specify the location of OpenSSL DLLs with option --opnessl=</path/to/openssl/bin>. - You can download OpenSSL for windows here: http://slproweb.com/products/Win32OpenSSL.html +OpenSSL: + Specifying the --openssl option is only required on Windows. It is a no-op for other platforms. + You can specify the location of OpenSSL DLLs with option --openssl=</path/to/openssl/bin>. + You can download OpenSSL for Windows here: http://slproweb.com/products/Win32OpenSSL.html + + Official Qt packages do not link to the SSL library directly, but rather try to find the library + at runtime. + + On Windows, official Qt builds will try to pick up OpenSSL libraries at application path, + system registry, or in the PATH environment variable. + On macOS, official Qt builds use SecureTransport (provided by OS) instead of OpenSSL. + On Linux, official Qt builds will try to pick up the system OpenSSL library. + + Note: this means that Qt packages that directly link to the OpenSSL shared libraries, are not + currently compatible with standalone PySide2 packages. OS X SDK: You can specify which OS X SDK should be used for compilation with the option --osx-sysroot=</path/to/sdk>. For e.g. "--osx-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/". @@ -784,7 +797,8 @@ class pyside_build(_build): log.info("Qt docs: %s" % self.qtinfo.docs_dir) log.info("Qt plugins: %s" % self.qtinfo.plugins_dir) log.info("-" * 3) - log.info("OpenSSL libs: %s" % OPTION_OPENSSL) + if sys.platform == 'win32': + log.info("OpenSSL dll directory: %s" % OPTION_OPENSSL) log.info("=" * 30) # Prepare folders 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) |