From 616e56ad6ae6ce240e22e5227c241d42ce73e7ac Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 25 Apr 2017 16:37:57 +0200 Subject: QtMultimedia: Add further classes Split typesystem_multimedia.xml into typesystem_multimedia_common.xml and typesystem_multimedia_forward_declarations.xml in order to be able to implement the overloads of QCamera::setViewfinder and QMediaPlayer::setVideoOutput() taking a QVideoWidget/ QGraphicsVideoItem, respectively. Task-number: PYSIDE-349 Task-number: PYSIDE-487 Change-Id: I4b8758f3715fbf12e9f05d48da18e0c65c17f06d Reviewed-by: Christian Tismer --- PySide2/QtMultimedia/CMakeLists.txt | 77 ++++- PySide2/QtMultimedia/typesystem_multimedia.xml | 113 +------ .../QtMultimedia/typesystem_multimedia_common.xml | 365 +++++++++++++++++++++ .../typesystem_multimedia_forward_declarations.xml | 45 +++ .../typesystem_multimediawidgets.xml | 2 +- 5 files changed, 482 insertions(+), 120 deletions(-) create mode 100644 PySide2/QtMultimedia/typesystem_multimedia_common.xml create mode 100644 PySide2/QtMultimedia/typesystem_multimedia_forward_declarations.xml diff --git a/PySide2/QtMultimedia/CMakeLists.txt b/PySide2/QtMultimedia/CMakeLists.txt index 51b5a042..a17455ee 100644 --- a/PySide2/QtMultimedia/CMakeLists.txt +++ b/PySide2/QtMultimedia/CMakeLists.txt @@ -1,21 +1,82 @@ project(QtMultimedia) set(QtMultimedia_SRC -${QtMultimedia_GEN_DIR}/qaudio_wrapper.cpp +${QtMultimedia_GEN_DIR}/qabstractaudiodeviceinfo_wrapper.cpp +${QtMultimedia_GEN_DIR}/qabstractaudioinput_wrapper.cpp +${QtMultimedia_GEN_DIR}/qabstractaudiooutput_wrapper.cpp ${QtMultimedia_GEN_DIR}/qabstractvideobuffer_wrapper.cpp -${QtMultimedia_GEN_DIR}/qvideosurfaceformat_wrapper.cpp +${QtMultimedia_GEN_DIR}/qabstractvideofilter_wrapper.cpp ${QtMultimedia_GEN_DIR}/qabstractvideosurface_wrapper.cpp +${QtMultimedia_GEN_DIR}/qaudiobuffer_wrapper.cpp +${QtMultimedia_GEN_DIR}/qaudiodecoder_wrapper.cpp +${QtMultimedia_GEN_DIR}/qaudiodecodercontrol_wrapper.cpp ${QtMultimedia_GEN_DIR}/qaudiodeviceinfo_wrapper.cpp -${QtMultimedia_GEN_DIR}/qabstractaudiodeviceinfo_wrapper.cpp -${QtMultimedia_GEN_DIR}/qabstractaudiooutput_wrapper.cpp -${QtMultimedia_GEN_DIR}/qabstractaudioinput_wrapper.cpp +${QtMultimedia_GEN_DIR}/qaudioencodersettingscontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qaudioencodersettings_wrapper.cpp ${QtMultimedia_GEN_DIR}/qaudioformat_wrapper.cpp +${QtMultimedia_GEN_DIR}/qaudioinputselectorcontrol_wrapper.cpp ${QtMultimedia_GEN_DIR}/qaudioinput_wrapper.cpp +${QtMultimedia_GEN_DIR}/qaudiooutputselectorcontrol_wrapper.cpp ${QtMultimedia_GEN_DIR}/qaudiooutput_wrapper.cpp -${QtMultimedia_GEN_DIR}/qvideoframe_wrapper.cpp +${QtMultimedia_GEN_DIR}/qaudioprobe_wrapper.cpp +${QtMultimedia_GEN_DIR}/qaudiorecorder_wrapper.cpp +${QtMultimedia_GEN_DIR}/qaudiorolecontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qaudio_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcameracapturebufferformatcontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcameracapturedestinationcontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcameracontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcameraexposurecontrol_wrapper.cpp +# Private destructor: ${QtMultimedia_GEN_DIR}/qcameraexposure_wrapper.cpp +# Private destructor: ${${QtMultimedia_GEN_DIR}/qcamerafocus_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcamerafocuszone_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcamera_frameraterange_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcameraimagecapturecontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcameraimagecapture_wrapper.cpp +# Private destructor: ${QtMultimedia_GEN_DIR}/qcameraimageprocessing_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcameraimageprocessingcontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcamerainfocontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcamerainfo_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcameralockscontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcameraviewfindersettingscontrol2_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcameraviewfindersettingscontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcameraviewfindersettings_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcamera_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcamerazoomcontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qimageencodercontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qimageencodersettings_wrapper.cpp +${QtMultimedia_GEN_DIR}/qmediaaudioprobecontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qmediaavailabilitycontrol_wrapper.cpp ${QtMultimedia_GEN_DIR}/qmediabindableinterface_wrapper.cpp +${QtMultimedia_GEN_DIR}/qmediacontainercontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qmediacontent_wrapper.cpp ${QtMultimedia_GEN_DIR}/qmediacontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qmediagaplessplaybackcontrol_wrapper.cpp +# Causes compile errors: ${QtMultimedia_GEN_DIR}/qmediametadata_wrapper.cpp +${QtMultimedia_GEN_DIR}/qmedianetworkaccesscontrol_wrapper.cpp ${QtMultimedia_GEN_DIR}/qmediaobject_wrapper.cpp +${QtMultimedia_GEN_DIR}/qmediaplayercontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qmediaplayer_wrapper.cpp +${QtMultimedia_GEN_DIR}/qmediaplaylist_wrapper.cpp +${QtMultimedia_GEN_DIR}/qmediarecordercontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qmediarecorder_wrapper.cpp +${QtMultimedia_GEN_DIR}/qmediaresource_wrapper.cpp +${QtMultimedia_GEN_DIR}/qmediatimerange_wrapper.cpp +${QtMultimedia_GEN_DIR}/qmultimedia_wrapper.cpp +${QtMultimedia_GEN_DIR}/qradiodatacontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qradiodata_wrapper.cpp +${QtMultimedia_GEN_DIR}/qradiotunercontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qradiotuner_wrapper.cpp +${QtMultimedia_GEN_DIR}/qsoundeffect_wrapper.cpp +${QtMultimedia_GEN_DIR}/qsound_wrapper.cpp +${QtMultimedia_GEN_DIR}/qvideodeviceselectorcontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qvideoencodersettingscontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qvideoencodersettings_wrapper.cpp +${QtMultimedia_GEN_DIR}/qvideofilterrunnable_wrapper.cpp +${QtMultimedia_GEN_DIR}/qvideoframe_wrapper.cpp +${QtMultimedia_GEN_DIR}/qvideoprobe_wrapper.cpp +${QtMultimedia_GEN_DIR}/qvideorenderercontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qvideosurfaceformat_wrapper.cpp +${QtMultimedia_GEN_DIR}/qvideowindowcontrol_wrapper.cpp # module is always needed ${QtMultimedia_GEN_DIR}/qtmultimedia_module_wrapper.cpp @@ -36,8 +97,8 @@ set(QtMultimedia_include_dirs ${QtMultimedia_SOURCE_DIR} ${SHIBOKEN_PYTHON_INCLUDE_DIR} ${QtCore_GEN_DIR} ${QtGui_GEN_DIR} - ${QtNetwork_GEN_DIR} - ) + ${QtNetwork_GEN_DIR}) + set(QtMultimedia_libraries pyside2 ${SHIBOKEN_PYTHON_LIBRARIES} ${SHIBOKEN_LIBRARY} diff --git a/PySide2/QtMultimedia/typesystem_multimedia.xml b/PySide2/QtMultimedia/typesystem_multimedia.xml index faf52961..275719f5 100644 --- a/PySide2/QtMultimedia/typesystem_multimedia.xml +++ b/PySide2/QtMultimedia/typesystem_multimedia.xml @@ -40,115 +40,6 @@ ****************************************************************************/ --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/PySide2/QtMultimedia/typesystem_multimedia_common.xml b/PySide2/QtMultimedia/typesystem_multimedia_common.xml new file mode 100644 index 00000000..9565b433 --- /dev/null +++ b/PySide2/QtMultimedia/typesystem_multimedia_common.xml @@ -0,0 +1,365 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %BEGIN_ALLOW_THREADS + QObject* upcastedArg = %CONVERTTOCPP[QObject*](%PYARG_1); + %CPPSELF.%FUNCTION_NAME(reinterpret_cast< %ARG1_TYPE >(upcastedArg)); + %END_ALLOW_THREADS + + + + + + + + %BEGIN_ALLOW_THREADS + QObject* upcastedArg = %CONVERTTOCPP[QObject*](%PYARG_1); + %CPPSELF.%FUNCTION_NAME(reinterpret_cast< %ARG1_TYPE >(upcastedArg)); + %END_ALLOW_THREADS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %BEGIN_ALLOW_THREADS + QObject* upcastedArg = %CONVERTTOCPP[QObject*](%PYARG_1); + %CPPSELF.%FUNCTION_NAME(reinterpret_cast< %ARG1_TYPE >(upcastedArg)); + %END_ALLOW_THREADS + + + + + + + + %BEGIN_ALLOW_THREADS + QObject* upcastedArg = %CONVERTTOCPP[QObject*](%PYARG_1); + %CPPSELF.%FUNCTION_NAME(reinterpret_cast< %ARG1_TYPE >(upcastedArg)); + %END_ALLOW_THREADS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PySide2/QtMultimedia/typesystem_multimedia_forward_declarations.xml b/PySide2/QtMultimedia/typesystem_multimedia_forward_declarations.xml new file mode 100644 index 00000000..df6e28c8 --- /dev/null +++ b/PySide2/QtMultimedia/typesystem_multimedia_forward_declarations.xml @@ -0,0 +1,45 @@ + + + + + + diff --git a/PySide2/QtMultimediaWidgets/typesystem_multimediawidgets.xml b/PySide2/QtMultimediaWidgets/typesystem_multimediawidgets.xml index 7de4c73d..76214bae 100644 --- a/PySide2/QtMultimediaWidgets/typesystem_multimediawidgets.xml +++ b/PySide2/QtMultimediaWidgets/typesystem_multimediawidgets.xml @@ -42,7 +42,7 @@ - + -- cgit v1.2.3 From 2e9f955a086fa7676c9eda60ca9e28cc03d9c5e2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 28 Apr 2017 16:43:36 +0200 Subject: QtGui: Add more non-GL related bindings Add: QBackingStore QEnterEvent QMarginsF QPageLayout QPageSize QPaintDeviceWindow QPixelFormat QPdfWriter QRasterWindow QRawFont QPaintDeviceWindow QStaticText QStyleHints Task-number: PYSIDE-487 Change-Id: I8926f55e4a5c71fc7e5b2293c4d300e305c6b56d Reviewed-by: Christian Tismer --- PySide2/QtCore/CMakeLists.txt | 1 + PySide2/QtCore/typesystem_core_common.xml | 1 + PySide2/QtGui/CMakeLists.txt | 11 ++++ PySide2/QtGui/typesystem_gui_common.xml | 36 +++++++++++++ tests/QtGui/CMakeLists.txt | 4 ++ tests/QtGui/qpdfwriter_test.py | 47 +++++++++++++++++ tests/QtGui/qpixelformat_test.py | 50 ++++++++++++++++++ tests/QtGui/qrasterwindow_test.py | 86 +++++++++++++++++++++++++++++++ tests/QtGui/qstylehints_test.py | 42 +++++++++++++++ 9 files changed, 278 insertions(+) create mode 100644 tests/QtGui/qpdfwriter_test.py create mode 100644 tests/QtGui/qpixelformat_test.py create mode 100644 tests/QtGui/qrasterwindow_test.py create mode 100644 tests/QtGui/qstylehints_test.py diff --git a/PySide2/QtCore/CMakeLists.txt b/PySide2/QtCore/CMakeLists.txt index 74f486f2..4e833f58 100644 --- a/PySide2/QtCore/CMakeLists.txt +++ b/PySide2/QtCore/CMakeLists.txt @@ -71,6 +71,7 @@ ${QtCore_GEN_DIR}/qline_wrapper.cpp ${QtCore_GEN_DIR}/qlinef_wrapper.cpp ${QtCore_GEN_DIR}/qlocale_wrapper.cpp ${QtCore_GEN_DIR}/qmargins_wrapper.cpp +${QtCore_GEN_DIR}/qmarginsf_wrapper.cpp ${QtCore_GEN_DIR}/qmessagelogcontext_wrapper.cpp ${QtCore_GEN_DIR}/qmetaclassinfo_wrapper.cpp ${QtCore_GEN_DIR}/qmetaenum_wrapper.cpp diff --git a/PySide2/QtCore/typesystem_core_common.xml b/PySide2/QtCore/typesystem_core_common.xml index f7960647..3bcf3d1b 100644 --- a/PySide2/QtCore/typesystem_core_common.xml +++ b/PySide2/QtCore/typesystem_core_common.xml @@ -3952,6 +3952,7 @@ s1.addTransition(button.clicked, s1h)</code> + diff --git a/PySide2/QtGui/CMakeLists.txt b/PySide2/QtGui/CMakeLists.txt index 3fa2effd..68c6bc79 100644 --- a/PySide2/QtGui/CMakeLists.txt +++ b/PySide2/QtGui/CMakeLists.txt @@ -8,6 +8,7 @@ ${QtGui_GEN_DIR}/qabstracttextdocumentlayout_selection_wrapper.cpp ${QtGui_GEN_DIR}/qabstracttextdocumentlayout_wrapper.cpp ${QtGui_GEN_DIR}/qaccessibleevent_wrapper.cpp ${QtGui_GEN_DIR}/qactionevent_wrapper.cpp +${QtGui_GEN_DIR}/qbackingstore_wrapper.cpp ${QtGui_GEN_DIR}/qbitmap_wrapper.cpp ${QtGui_GEN_DIR}/qbrush_wrapper.cpp ${QtGui_GEN_DIR}/qclipboard_wrapper.cpp @@ -23,6 +24,7 @@ ${QtGui_GEN_DIR}/qdragenterevent_wrapper.cpp ${QtGui_GEN_DIR}/qdragleaveevent_wrapper.cpp ${QtGui_GEN_DIR}/qdragmoveevent_wrapper.cpp ${QtGui_GEN_DIR}/qdropevent_wrapper.cpp +${QtGui_GEN_DIR}/qenterevent_wrapper.cpp ${QtGui_GEN_DIR}/qexposeevent_wrapper.cpp ${QtGui_GEN_DIR}/qfileopenevent_wrapper.cpp ${QtGui_GEN_DIR}/qfocusevent_wrapper.cpp @@ -66,7 +68,10 @@ ${QtGui_GEN_DIR}/qmoveevent_wrapper.cpp ${QtGui_GEN_DIR}/qmovie_wrapper.cpp ${QtGui_GEN_DIR}/qpagedpaintdevice_margins_wrapper.cpp ${QtGui_GEN_DIR}/qpagedpaintdevice_wrapper.cpp +${QtGui_GEN_DIR}/qpagelayout_wrapper.cpp +${QtGui_GEN_DIR}/qpagesize_wrapper.cpp ${QtGui_GEN_DIR}/qpaintdevice_wrapper.cpp +${QtGui_GEN_DIR}/qpaintdevicewindow_wrapper.cpp ${QtGui_GEN_DIR}/qpaintengine_wrapper.cpp ${QtGui_GEN_DIR}/qpaintenginestate_wrapper.cpp ${QtGui_GEN_DIR}/qpainter_pixmapfragment_wrapper.cpp @@ -76,12 +81,14 @@ ${QtGui_GEN_DIR}/qpainterpath_wrapper.cpp ${QtGui_GEN_DIR}/qpainterpathstroker_wrapper.cpp ${QtGui_GEN_DIR}/qpaintevent_wrapper.cpp ${QtGui_GEN_DIR}/qpalette_wrapper.cpp +${QtGui_GEN_DIR}/qpdfwriter_wrapper.cpp ${QtGui_GEN_DIR}/qpen_wrapper.cpp ${QtGui_GEN_DIR}/qpicture_wrapper.cpp ${QtGui_GEN_DIR}/qpictureio_wrapper.cpp ${QtGui_GEN_DIR}/qpixmap_wrapper.cpp ${QtGui_GEN_DIR}/qpixmapcache_key_wrapper.cpp ${QtGui_GEN_DIR}/qpixmapcache_wrapper.cpp +${QtGui_GEN_DIR}/qpixelformat_wrapper.cpp ${QtGui_GEN_DIR}/qpolygon_wrapper.cpp ${QtGui_GEN_DIR}/qpolygonf_wrapper.cpp ${QtGui_GEN_DIR}/qpytextobject_wrapper.cpp @@ -106,6 +113,10 @@ ${QtGui_GEN_DIR}/qscreen_wrapper.cpp ${QtGui_GEN_DIR}/qopenglshader_wrapper.cpp #${QtGui_GEN_DIR}/qopenglshaderprogram_wrapper.cpp ${QtGui_GEN_DIR}/qopenglframebufferobject_wrapper.cpp +${QtGui_GEN_DIR}/qrasterwindow_wrapper.cpp +${QtGui_GEN_DIR}/qrawfont_wrapper.cpp +${QtGui_GEN_DIR}/qstatictext_wrapper.cpp +${QtGui_GEN_DIR}/qstylehints_wrapper.cpp ${QtGui_GEN_DIR}/qsurface_wrapper.cpp ${QtGui_GEN_DIR}/qsurfaceformat_wrapper.cpp ${QtGui_GEN_DIR}/qsyntaxhighlighter_wrapper.cpp diff --git a/PySide2/QtGui/typesystem_gui_common.xml b/PySide2/QtGui/typesystem_gui_common.xml index 90ba5f9a..439ca3c9 100644 --- a/PySide2/QtGui/typesystem_gui_common.xml +++ b/PySide2/QtGui/typesystem_gui_common.xml @@ -105,6 +105,10 @@ + + + + @@ -291,6 +295,9 @@ + + + @@ -1738,6 +1745,7 @@ + @@ -3186,6 +3194,7 @@ + @@ -3267,7 +3276,34 @@ typesystem. --> + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index f41a0f8b..63cf3c35 100644 --- a/tests/QtGui/CMakeLists.txt +++ b/tests/QtGui/CMakeLists.txt @@ -29,12 +29,16 @@ PYSIDE_TEST(qitemselection_test.py) PYSIDE_TEST(qmatrix_test.py) PYSIDE_TEST(qopenglbuffer_test.py) PYSIDE_TEST(qpainter_test.py) +PYSIDE_TEST(qpdfwriter_test.py) +PYSIDE_TEST(qpixelformat_test.py) PYSIDE_TEST(qpixmap_test.py) PYSIDE_TEST(qpixmapcache_test.py) PYSIDE_TEST(qpolygonf_test.py) PYSIDE_TEST(qkeysequence_test.py) PYSIDE_TEST(qradialgradient_test.py) +PYSIDE_TEST(qrasterwindow_test.py) PYSIDE_TEST(qregion_test.py) +PYSIDE_TEST(qstylehints_test.py) PYSIDE_TEST(qtextdocument_undoredo_test.py) PYSIDE_TEST(qtextdocumentwriter_test.py) PYSIDE_TEST(qtextline_test.py) diff --git a/tests/QtGui/qpdfwriter_test.py b/tests/QtGui/qpdfwriter_test.py new file mode 100644 index 00000000..f97c85b3 --- /dev/null +++ b/tests/QtGui/qpdfwriter_test.py @@ -0,0 +1,47 @@ +############################################################################# +## +## Copyright (C) 2017 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 helper import UsesQApplication +from PySide2.QtGui import QPageLayout, QPageSize, QPdfWriter, QTextDocument +from PySide2.QtCore import QDir, QMarginsF, QTemporaryFile + +class QPdfWriterTest(UsesQApplication): + + def testWrite(self): + temporaryFile = QTemporaryFile(QDir.tempPath() + "/pdfwriter_test_XXXXXX.pdf") + self.assertTrue(temporaryFile.open()) + pdfWriter = QPdfWriter(temporaryFile) + pdfWriter.setPageLayout(QPageLayout(QPageSize(QPageSize.A4), QPageLayout.Portrait, QMarginsF(10, 10, 10, 10))) + doc = QTextDocument("Some text") + doc.print_(pdfWriter) + temporaryFile.close() + self.assertTrue(temporaryFile.size() > 0) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/QtGui/qpixelformat_test.py b/tests/QtGui/qpixelformat_test.py new file mode 100644 index 00000000..c7f14ff2 --- /dev/null +++ b/tests/QtGui/qpixelformat_test.py @@ -0,0 +1,50 @@ +############################################################################# +## +## Copyright (C) 2017 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 QPixelFormat''' + +import unittest + +from helper import UsesQApplication +from PySide2.QtCore import QSize, Qt +from PySide2.QtGui import QColor, QImage, QPixelFormat + +class QPixelFormatTest(UsesQApplication): + def test(self): + image = QImage(QSize(200, 200), QImage.Format_ARGB32) + image.fill(QColor(Qt.red)) + pixelFormat = image.pixelFormat() + print(pixelFormat.greenSize()) + self.assertEqual(pixelFormat.alphaSize(), 8) + self.assertEqual(pixelFormat.redSize(), 8) + self.assertEqual(pixelFormat.greenSize(), 8) + self.assertEqual(pixelFormat.blueSize(), 8) + self.assertEqual(pixelFormat.bitsPerPixel(), 32) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/QtGui/qrasterwindow_test.py b/tests/QtGui/qrasterwindow_test.py new file mode 100644 index 00000000..db756ff8 --- /dev/null +++ b/tests/QtGui/qrasterwindow_test.py @@ -0,0 +1,86 @@ +############################################################################# +## +## Copyright (C) 2017 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 QBackingStore, QRasterWindow and QStaticText''' + +import unittest + +from helper import UsesQApplication +from PySide2.QtCore import QEvent, QPoint, QRect, QSize, QTimer, Qt +from PySide2.QtGui import QColor, QBackingStore, QPaintDevice, QPainter, QWindow, QPaintDeviceWindow, QRasterWindow, QRegion, QStaticText + +# QWindow rendering via QBackingStore +class TestBackingStoreWindow(QWindow): + def __init__(self): + super(TestBackingStoreWindow, self).__init__() + self.backingStore = QBackingStore(self) + self.text = QStaticText("BackingStoreWindow") + + def event(self, event): + if event.type() == QEvent.Resize: + self.backingStore.resize(self.size()) + self.render() + elif event.type() == QEvent.UpdateRequest or event.type() == QEvent.Expose: + self.backingStore.flush(QRegion(QRect(QPoint(0, 0), self.size()))) + + return QWindow.event(self, event) + + def render(self): + clientRect = QRect(QPoint(0, 0), self.size()) + painter = QPainter(self.backingStore.paintDevice()) + painter.fillRect(clientRect, QColor(Qt.green)) + painter.drawStaticText(QPoint(10, 10), self.text) + +# Window using convenience class QRasterWindow +class TestRasterWindow(QRasterWindow): + def __init__(self): + super(TestRasterWindow, self).__init__() + self.text = QStaticText("QRasterWindow") + + def paintEvent(self, event): + clientRect = QRect(QPoint(0, 0), self.size()) + painter = QPainter(self) + painter.fillRect(clientRect, QColor(Qt.red)) + painter.drawStaticText(QPoint(10, 10), self.text) + +class QRasterWindowTest(UsesQApplication): + def test(self): + rasterWindow = TestRasterWindow() + rasterWindow.setFramePosition(QPoint(100, 100)) + rasterWindow.resize(QSize(400, 400)) + rasterWindow.show() + backingStoreWindow = TestBackingStoreWindow() + backingStoreWindow.setFramePosition(QPoint(600, 100)) + backingStoreWindow.resize(QSize(400, 400)) + backingStoreWindow.show() + + QTimer.singleShot(100, self.app.quit) + self.app.exec_() + +if __name__ == '__main__': + unittest.main() diff --git a/tests/QtGui/qstylehints_test.py b/tests/QtGui/qstylehints_test.py new file mode 100644 index 00000000..c3d99aa3 --- /dev/null +++ b/tests/QtGui/qstylehints_test.py @@ -0,0 +1,42 @@ +############################################################################# +## +## Copyright (C) 2017 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 QStyleHints''' + +import unittest + +from helper import UsesQApplication +from PySide2.QtGui import QStyleHints + +class QStyleHintsTest(UsesQApplication): + def test(self): + styleHints = self.app.styleHints() + self.assertTrue(styleHints.startDragDistance() > 0) + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.3 From 19aed1b523203754edbac049f68d4a012a5c954d Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 2 May 2017 19:50:49 +0800 Subject: Add support for Qt Win Extras module Task-number: PYSIDE-487 Change-Id: Ie7cb4df3900fca36b0ef4747f351ab0600d8f45c Reviewed-by: Friedemann Kleint --- PySide2/CMakeLists.txt | 12 ++++++ PySide2/QtWinExtras/CMakeLists.txt | 51 +++++++++++++++++++++++ PySide2/QtWinExtras/typesystem_winextras.xml | 61 ++++++++++++++++++++++++++++ PySide2/global.h.in | 4 ++ tests/CMakeLists.txt | 4 ++ tests/QtWinExtras/CMakeLists.txt | 1 + tests/QtWinExtras/this_module_loads_test.py | 39 ++++++++++++++++++ 7 files changed, 172 insertions(+) create mode 100644 PySide2/QtWinExtras/CMakeLists.txt create mode 100644 PySide2/QtWinExtras/typesystem_winextras.xml create mode 100644 tests/QtWinExtras/CMakeLists.txt create mode 100644 tests/QtWinExtras/this_module_loads_test.py diff --git a/PySide2/CMakeLists.txt b/PySide2/CMakeLists.txt index 72ce3501..cc384324 100644 --- a/PySide2/CMakeLists.txt +++ b/PySide2/CMakeLists.txt @@ -35,6 +35,10 @@ if(UNIX AND NOT APPLE) find_package(Qt5X11Extras) endif() +if(WIN32) + find_package(Qt5WinExtras) +endif() + # Configure include based on platform configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in" "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h" @ONLY) @@ -150,6 +154,10 @@ if(UNIX AND NOT APPLE) CHECK_PACKAGE_FOUND(Qt5X11Extras opt) endif() +if(WIN32) + CHECK_PACKAGE_FOUND(Qt5WinExtras opt) +endif() + # note: the order of this list is relevant for dependencies. # For instance: Qt5Printsupport must come before Qt5WebKitWidgets HAS_QT_MODULE(Qt5Core_FOUND QtCore) @@ -212,6 +220,10 @@ if(UNIX AND NOT APPLE) has_qt_module(Qt5X11Extras_FOUND QtX11Extras) endif() +if(WIN32) + has_qt_module(Qt5WinExtras_FOUND QtWinExtras) +endif() + # install install(FILES "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" DESTINATION "${SITE_PACKAGE}/${BINDING_NAME}${pyside2_SUFFIX}") diff --git a/PySide2/QtWinExtras/CMakeLists.txt b/PySide2/QtWinExtras/CMakeLists.txt new file mode 100644 index 00000000..4de43701 --- /dev/null +++ b/PySide2/QtWinExtras/CMakeLists.txt @@ -0,0 +1,51 @@ +project(QtWinExtras) + +set(QtWinExtras_SRC +${QtWinExtras_GEN_DIR}/qwincolorizationchangeevent_wrapper.cpp +${QtWinExtras_GEN_DIR}/qwincompositionchangeevent_wrapper.cpp +${QtWinExtras_GEN_DIR}/qwinevent_wrapper.cpp +${QtWinExtras_GEN_DIR}/qwinjumplist_wrapper.cpp +${QtWinExtras_GEN_DIR}/qwinjumplistcategory_wrapper.cpp +${QtWinExtras_GEN_DIR}/qwinjumplistitem_wrapper.cpp +#${QtWinExtras_GEN_DIR}/qwinmime_wrapper.cpp +${QtWinExtras_GEN_DIR}/qwintaskbarbutton_wrapper.cpp +${QtWinExtras_GEN_DIR}/qwintaskbarprogress_wrapper.cpp +${QtWinExtras_GEN_DIR}/qwinthumbnailtoolbar_wrapper.cpp +${QtWinExtras_GEN_DIR}/qwinthumbnailtoolbutton_wrapper.cpp + +# module is always needed +${QtWinExtras_GEN_DIR}/qtwinextras_module_wrapper.cpp +) + +make_path(QtWinExtras_typesystem_path ${QtWinExtras_SOURCE_DIR} + ${QtCore_SOURCE_DIR} + ${QtCore_BINARY_DIR} + ${QtGui_SOURCE_DIR} + ${QtGui_BINARY_DIR}) + +set(QtWinExtras_include_dirs ${QtWinExtras_SOURCE_DIR} + ${QtWinExtras_BINARY_DIR} + ${Qt5WinExtras_INCLUDE_DIRS} + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Gui_INCLUDE_DIRS} + ${QtCore_GEN_DIR} + ${QtGui_GEN_DIR} + ${SHIBOKEN_PYTHON_INCLUDE_DIR} + ${SHIBOKEN_INCLUDE_DIR} + ${libpyside_SOURCE_DIR}) + +set(QtWinExtras_libraries pyside2 + ${Qt5WinExtras_LIBRARIES} + ${SHIBOKEN_PYTHON_LIBRARIES} + ${Qt5Core_LIBRARIES} + ${Qt5Gui_LIBRARIES}) + +set(QtWinExtras_deps QtCore QtGui) + +create_pyside_module(QtWinExtras + QtWinExtras_include_dirs + QtWinExtras_libraries + QtWinExtras_deps + QtWinExtras_typesystem_path + QtWinExtras_SRC + "") diff --git a/PySide2/QtWinExtras/typesystem_winextras.xml b/PySide2/QtWinExtras/typesystem_winextras.xml new file mode 100644 index 00000000..d7d400be --- /dev/null +++ b/PySide2/QtWinExtras/typesystem_winextras.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/PySide2/global.h.in b/PySide2/global.h.in index c8628521..d3b1f695 100644 --- a/PySide2/global.h.in +++ b/PySide2/global.h.in @@ -463,6 +463,10 @@ QT_END_NAMESPACE # include #endif +#if @Qt5WinExtras_FOUND@ +# include +#endif + //QtHelp needs to be included after QtSql. Why? #include diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bd1385d2..fdfb0ead 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -82,6 +82,10 @@ else() TEST_QT_MODULE(Qt5X11Extras_FOUND QtX11Extras) endif() + if(WIN32) + TEST_QT_MODULE(Qt5WinExtras_FOUND QtWinExtras) + endif() + #platform specific if (ENABLE_MAC) add_subdirectory(mac) diff --git a/tests/QtWinExtras/CMakeLists.txt b/tests/QtWinExtras/CMakeLists.txt new file mode 100644 index 00000000..79c5c83a --- /dev/null +++ b/tests/QtWinExtras/CMakeLists.txt @@ -0,0 +1 @@ +PYSIDE_TEST(this_module_loads_test.py) diff --git a/tests/QtWinExtras/this_module_loads_test.py b/tests/QtWinExtras/this_module_loads_test.py new file mode 100644 index 00000000..0bf67354 --- /dev/null +++ b/tests/QtWinExtras/this_module_loads_test.py @@ -0,0 +1,39 @@ +############################################################################# +## +## Copyright (C) 2017 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 os + +modname = os.path.basename(os.path.dirname(__file__)) +try: + exec("from PySide2 import {}".format(modname)) + print("The module {} loads. That is the minimum test, folks :-)".format(modname)) +except ImportError: + print("The module {} did not load! Did you include all classes in CMake?".format(modname)) + raise -- cgit v1.2.3 From c46d6813e5efa353e569b13d09943a6e6151c0f0 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 3 May 2017 09:07:19 +0200 Subject: Add support for Qt Mac Extras module Task-number: PYSIDE-487 Change-Id: I26e4e2c443098b2309a1d3c954f7e80d16b86d81 Reviewed-by: Friedemann Kleint Reviewed-by: Christian Tismer --- PySide2/CMakeLists.txt | 12 ++++++ PySide2/QtMacExtras/CMakeLists.txt | 43 ++++++++++++++++++++++ PySide2/QtMacExtras/typesystem_macextras.xml | 55 ++++++++++++++++++++++++++++ PySide2/global.h.in | 4 ++ tests/CMakeLists.txt | 4 ++ tests/QtMacExtras/CMakeLists.txt | 1 + tests/QtMacExtras/this_module_loads_test.py | 39 ++++++++++++++++++++ 7 files changed, 158 insertions(+) create mode 100644 PySide2/QtMacExtras/CMakeLists.txt create mode 100644 PySide2/QtMacExtras/typesystem_macextras.xml create mode 100644 tests/QtMacExtras/CMakeLists.txt create mode 100644 tests/QtMacExtras/this_module_loads_test.py diff --git a/PySide2/CMakeLists.txt b/PySide2/CMakeLists.txt index cc384324..ec4b44cc 100644 --- a/PySide2/CMakeLists.txt +++ b/PySide2/CMakeLists.txt @@ -39,6 +39,10 @@ if(WIN32) find_package(Qt5WinExtras) endif() +if(APPLE) + find_package(Qt5MacExtras) +endif() + # Configure include based on platform configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in" "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h" @ONLY) @@ -158,6 +162,10 @@ if(WIN32) CHECK_PACKAGE_FOUND(Qt5WinExtras opt) endif() +if(APPLE) + CHECK_PACKAGE_FOUND(Qt5MacExtras opt) +endif() + # note: the order of this list is relevant for dependencies. # For instance: Qt5Printsupport must come before Qt5WebKitWidgets HAS_QT_MODULE(Qt5Core_FOUND QtCore) @@ -224,6 +232,10 @@ if(WIN32) has_qt_module(Qt5WinExtras_FOUND QtWinExtras) endif() +if(APPLE) + has_qt_module(Qt5MacExtras_FOUND QtMacExtras) +endif() + # install install(FILES "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" DESTINATION "${SITE_PACKAGE}/${BINDING_NAME}${pyside2_SUFFIX}") diff --git a/PySide2/QtMacExtras/CMakeLists.txt b/PySide2/QtMacExtras/CMakeLists.txt new file mode 100644 index 00000000..9bb8dd00 --- /dev/null +++ b/PySide2/QtMacExtras/CMakeLists.txt @@ -0,0 +1,43 @@ +project(QtMacExtras) + +set(QtMacExtras_SRC +#${QtMacExtras_GEN_DIR}/qmacpasteboardmime_wrapper.cpp +${QtMacExtras_GEN_DIR}/qmactoolbar_wrapper.cpp +${QtMacExtras_GEN_DIR}/qmactoolbaritem_wrapper.cpp + +# module is always needed +${QtMacExtras_GEN_DIR}/QtMacExtras_module_wrapper.cpp +) + +make_path(QtMacExtras_typesystem_path ${QtMacExtras_SOURCE_DIR} + ${QtCore_SOURCE_DIR} + ${QtCore_BINARY_DIR} + ${QtGui_SOURCE_DIR} + ${QtGui_BINARY_DIR}) + +set(QtMacExtras_include_dirs ${QtMacExtras_SOURCE_DIR} + ${QtMacExtras_BINARY_DIR} + ${Qt5MacExtras_INCLUDE_DIRS} + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Gui_INCLUDE_DIRS} + ${QtCore_GEN_DIR} + ${QtGui_GEN_DIR} + ${SHIBOKEN_PYTHON_INCLUDE_DIR} + ${SHIBOKEN_INCLUDE_DIR} + ${libpyside_SOURCE_DIR}) + +set(QtMacExtras_libraries pyside2 + ${Qt5MacExtras_LIBRARIES} + ${SHIBOKEN_PYTHON_LIBRARIES} + ${Qt5Core_LIBRARIES} + ${Qt5Gui_LIBRARIES}) + +set(QtMacExtras_deps QtCore QtGui) + +create_pyside_module(QtMacExtras + QtMacExtras_include_dirs + QtMacExtras_libraries + QtMacExtras_deps + QtMacExtras_typesystem_path + QtMacExtras_SRC + "") diff --git a/PySide2/QtMacExtras/typesystem_macextras.xml b/PySide2/QtMacExtras/typesystem_macextras.xml new file mode 100644 index 00000000..f52597cd --- /dev/null +++ b/PySide2/QtMacExtras/typesystem_macextras.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + diff --git a/PySide2/global.h.in b/PySide2/global.h.in index d3b1f695..020c9c19 100644 --- a/PySide2/global.h.in +++ b/PySide2/global.h.in @@ -467,6 +467,10 @@ QT_END_NAMESPACE # include #endif +#if @Qt5MacExtras_FOUND@ +# include +#endif + //QtHelp needs to be included after QtSql. Why? #include diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fdfb0ead..5fe2d7db 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -86,6 +86,10 @@ else() TEST_QT_MODULE(Qt5WinExtras_FOUND QtWinExtras) endif() + if(APPLE) + TEST_QT_MODULE(Qt5MacExtras_FOUND QtMacExtras) + endif() + #platform specific if (ENABLE_MAC) add_subdirectory(mac) diff --git a/tests/QtMacExtras/CMakeLists.txt b/tests/QtMacExtras/CMakeLists.txt new file mode 100644 index 00000000..79c5c83a --- /dev/null +++ b/tests/QtMacExtras/CMakeLists.txt @@ -0,0 +1 @@ +PYSIDE_TEST(this_module_loads_test.py) diff --git a/tests/QtMacExtras/this_module_loads_test.py b/tests/QtMacExtras/this_module_loads_test.py new file mode 100644 index 00000000..0bf67354 --- /dev/null +++ b/tests/QtMacExtras/this_module_loads_test.py @@ -0,0 +1,39 @@ +############################################################################# +## +## Copyright (C) 2017 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 os + +modname = os.path.basename(os.path.dirname(__file__)) +try: + exec("from PySide2 import {}".format(modname)) + print("The module {} loads. That is the minimum test, folks :-)".format(modname)) +except ImportError: + print("The module {} did not load! Did you include all classes in CMake?".format(modname)) + raise -- cgit v1.2.3 From a3027cc4e5cc30663f700284b0dc6a19640ccca7 Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Thu, 4 May 2017 16:41:31 +0200 Subject: CMakeLists.txt: find python interpreter first CMake documentation recommends ordering find_package(PythonInterp) before find_package(PythonLibs) when both are called. Change-Id: Ic09f40b999d446146f58c1e6dab2ba920d8821a5 Reviewed-by: Alexandru Croitor --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index efc8f687..af8b5fab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,11 +11,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Macros/ option(USE_PYTHON_VERSION "Use specific python version to build pyside2." "") if (USE_PYTHON_VERSION) - find_package(PythonLibs ${USE_PYTHON_VERSION} REQUIRED) find_package(PythonInterp ${USE_PYTHON_VERSION} REQUIRED) + find_package(PythonLibs ${USE_PYTHON_VERSION} REQUIRED) else() - find_package(PythonLibs 2.6) find_package(PythonInterp 2.6) + find_package(PythonLibs 2.6) endif() # Queries the python sysconfig for the abi flags which need to be inserted into extension suffixes. -- cgit v1.2.3 From 81f92097fd8475bf8fb15cc8c249c4e71715e706 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 8 May 2017 15:02:25 +0200 Subject: QtGui/QRawFont: Exclude member functions with array parameters Fix warnings: qt.shiboken: There's no user provided way (conversion rule, argument removal, custom code, etc) to handle the primitive argument type 'const quint32 *' in function 'QRawFont::advancesForGlyphIndexes(const quint32 * glyphIndexes, QPointF * advances, int numGlyphs) const'. qt.shiboken: There's no user provided way (conversion rule, argument removal, custom code, etc) to handle the primitive argument type 'const QChar *' in function 'QRawFont::glyphIndexesForChars(const QChar * chars, int numChars, quint32 * glyphIndexes, int * numGlyphs) const'. ... Amends 2e9f955a086fa7676c9eda60ca9e28cc03d9c5e2. Task-number: PYSIDE-487 Change-Id: I5db3ef75d80dc478783730a1c640101f90d0b65a Reviewed-by: Christian Tismer --- PySide2/QtGui/typesystem_gui_common.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PySide2/QtGui/typesystem_gui_common.xml b/PySide2/QtGui/typesystem_gui_common.xml index 439ca3c9..7a0db8a4 100644 --- a/PySide2/QtGui/typesystem_gui_common.xml +++ b/PySide2/QtGui/typesystem_gui_common.xml @@ -3300,6 +3300,9 @@ + + + -- cgit v1.2.3 From 98b6c69ee91a78d0eb7f20130272a612770fbbbe Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Mon, 1 May 2017 11:27:58 +0200 Subject: Remove fixup_headers after fixing shiboken for C++11 The hack for VS 2015 is replaced by a shiboken patch. This must be immediately applied after shiboken was fixed. Reason: The build would work, but Windows will not load because of missing symbols! Task-number: PYSIDE-504 Change-Id: I3ce8989632748b8967228a9993b11c599a858b91 Reviewed-by: Friedemann Kleint --- CMakeLists.txt | 9 ++++- PySide2/CMakeLists.txt | 8 ----- PySide2/QtGui/CMakeLists.txt | 5 --- PySide2/QtGui/fixup_headers.py | 78 ----------------------------------------- PySide2/QtHelp/CMakeLists.txt | 5 --- PySide2/QtHelp/fixup_headers.py | 74 -------------------------------------- 6 files changed, 8 insertions(+), 171 deletions(-) delete mode 100644 PySide2/QtGui/fixup_headers.py delete mode 100644 PySide2/QtHelp/fixup_headers.py diff --git a/CMakeLists.txt b/CMakeLists.txt index af8b5fab..4e9a8919 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -299,7 +299,14 @@ if (NOT SITE_PACKAGE) endif() endif() -set(GENERATOR_EXTRA_FLAGS --generator-set=shiboken --enable-parent-ctor-heuristic --enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero) +set(GENERATOR_EXTRA_FLAGS --generator-set=shiboken + --enable-parent-ctor-heuristic + --enable-pyside-extensions + --enable-return-value-heuristic + --use-isnull-as-nb_nonzero) +# 2017-04-24 The protected hack can unfortunately not be disabled, because +# Clang does produce linker errors when we disable the hack. +# But the ugly workaround in Python is replaced by a shiboken change. if(WIN32 OR DEFINED AVOID_PROTECTED_HACK) message(STATUS "PySide2 will be generated avoiding the protected hack!") set(GENERATOR_EXTRA_FLAGS ${GENERATOR_EXTRA_FLAGS} --avoid-protected-hack) diff --git a/PySide2/CMakeLists.txt b/PySide2/CMakeLists.txt index ec4b44cc..0fe42ce6 100644 --- a/PySide2/CMakeLists.txt +++ b/PySide2/CMakeLists.txt @@ -116,14 +116,6 @@ macro(skip_missing_classes sources) f.writelines(lines) removals = sorted(list(removals)) print('Removals:', removals) - fix_header_fname = '${CMAKE_CURRENT_SOURCE_DIR}/fixup_headers.py' - if sys.platform == 'win32' and os.path.exists(fix_header_fname): - global target_dir - target_dir = '${${PROJECT_NAME}_GEN_DIR}' - - with open(fix_header_fname) as f: - code = compile(f.read(), 'nebbich', 'exec') - exec(code, globals(), locals()) ") endmacro() diff --git a/PySide2/QtGui/CMakeLists.txt b/PySide2/QtGui/CMakeLists.txt index 68c6bc79..a6a8c104 100644 --- a/PySide2/QtGui/CMakeLists.txt +++ b/PySide2/QtGui/CMakeLists.txt @@ -193,11 +193,6 @@ set(QtGui_libraries pyside2 ${Qt5Gui_LIBRARIES}) set(QtGui_deps QtCore) -if(WIN32) - # has a fix for VS2015 - skip_missing_classes(QtGui_SRC) -endif() - create_pyside_module(QtGui QtGui_include_dirs QtGui_libraries diff --git a/PySide2/QtGui/fixup_headers.py b/PySide2/QtGui/fixup_headers.py deleted file mode 100644 index cf9d1f19..00000000 --- a/PySide2/QtGui/fixup_headers.py +++ /dev/null @@ -1,78 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of PySide2. -## -## $QT_BEGIN_LICENSE:LGPL$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU Lesser General Public License Usage -## Alternatively, this file may be used under the terms of the GNU Lesser -## General Public License version 3 as published by the Free Software -## Foundation and appearing in the file LICENSE.LGPL3 included in the -## packaging of this file. Please review the following information to -## ensure the GNU Lesser General Public License version 3 requirements -## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 2.0 or (at your option) the GNU General -## Public license version 3 or any later version approved by the KDE Free -## Qt Foundation. The licenses are as published by the Free Software -## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-2.0.html and -## https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from __future__ import print_function - -""" -This script adds a constructor to wrappers where the constructor -of the base class is not reachable (private). - -It is run via the equivalent of an execfile command. -This patch became necessary when VS2015 became the standard compiler. -""" - -import os - -def patch(fname, snippet, path=target_dir): - fpath = os.path.join(path, fname) - with open(fpath, 'r') as f: - lines = f.readlines() - for idx, line in enumerate(lines): - if line.rstrip() == "public:": - break - else: - raise SyntaxError("no public section found") - lines[idx+1:idx+1] = snippet - with open(fpath, 'w') as f: - f.writelines(lines) - print("+++ patched file:", fpath) - -snippets = { - "qclipboard_wrapper.h" : """\ - QClipboardWrapper(QObject *parent); - ~QClipboardWrapper(); -""", - "qsessionmanager_wrapper.h" : """\ - QSessionManagerWrapper(QGuiApplication *app, QString &id, QString &key); - ~QSessionManagerWrapper(); -""", -} - -for snippet, addition in snippets.items(): - patch(snippet, addition) diff --git a/PySide2/QtHelp/CMakeLists.txt b/PySide2/QtHelp/CMakeLists.txt index 2c7c2fdd..ba8b419f 100644 --- a/PySide2/QtHelp/CMakeLists.txt +++ b/PySide2/QtHelp/CMakeLists.txt @@ -42,11 +42,6 @@ set(QtHelp_libraries pyside2 set(QtHelp_deps QtWidgets) -if(WIN32) - # has a fix for VS2015 - skip_missing_classes(QtHelp_SRC) -endif() - create_pyside_module(QtHelp QtHelp_include_dirs QtHelp_libraries diff --git a/PySide2/QtHelp/fixup_headers.py b/PySide2/QtHelp/fixup_headers.py deleted file mode 100644 index d25b04b2..00000000 --- a/PySide2/QtHelp/fixup_headers.py +++ /dev/null @@ -1,74 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of PySide2. -## -## $QT_BEGIN_LICENSE:LGPL$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU Lesser General Public License Usage -## Alternatively, this file may be used under the terms of the GNU Lesser -## General Public License version 3 as published by the Free Software -## Foundation and appearing in the file LICENSE.LGPL3 included in the -## packaging of this file. Please review the following information to -## ensure the GNU Lesser General Public License version 3 requirements -## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 2.0 or (at your option) the GNU General -## Public license version 3 or any later version approved by the KDE Free -## Qt Foundation. The licenses are as published by the Free Software -## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-2.0.html and -## https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from __future__ import print_function - -""" -This script adds a constructor to wrappers where the constructor -of the base class is not reachable (private). - -It is run via the equivalent of an execfile command. -This patch became necessary when VS2015 became the standard compiler. -""" - -import os - -def patch(fname, snippet, path=target_dir): - fpath = os.path.join(path, fname) - with open(fpath, 'r') as f: - lines = f.readlines() - for idx, line in enumerate(lines): - if line.rstrip() == "public:": - break - else: - raise SyntaxError("no public section found") - lines[idx+1:idx+1] = snippet - with open(fpath, 'w') as f: - f.writelines(lines) - print("+++ patched file:", fpath) - -snippets = { - "qhelpindexmodel_wrapper.h" : """\ - QHelpIndexModelWrapper(QHelpEnginePrivate *helpEngine); - ~QHelpIndexModelWrapper(); -""", -} - -for snippet, addition in snippets.items(): - patch(snippet, addition) -- cgit v1.2.3 From a80a6eb94433529a6d984e8ff22874f7dff48eea Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Mon, 1 May 2017 11:44:19 +0200 Subject: Rewrite CMake scripts and generate includes for global.h.in The CMake files are repeating code three times, which should be avoided. Also, the global.h.in contained too many unconditional includes, which becomes relevant for the PySide 5.9 branch when missing includes are no longer ignored. Instead of maintaining an always growing list of conditionals (did that first), the needed includes are now computed by CMake, and the collected includes are appended to pyside2_global.h . Task-number: PYSIDE-507 Change-Id: I86f27d42c2d60d75ab4597e262e874c7186389c8 Reviewed-by: Friedemann Kleint --- CMakeLists.txt | 37 +------- PySide2/CMakeLists.txt | 251 ++++++++++++++----------------------------------- PySide2/global.h.in | 82 +++------------- tests/CMakeLists.txt | 44 +-------- 4 files changed, 92 insertions(+), 322 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e9a8919..89d4dc7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,7 +104,7 @@ if (UNIX AND NOT APPLE) endif () find_package(Shiboken2 2.0.0 REQUIRED) -find_package(Qt5 5.3.0 REQUIRED COMPONENTS Core) +find_package(Qt5 5.6.0 REQUIRED COMPONENTS Core) add_definitions(${Qt5Core_DEFINITIONS}) find_file(GL_H "gl.h" PATH_SUFFIXES "GL") @@ -188,38 +188,6 @@ else() CACHE STRING "PySide version [full]" FORCE) endif() -find_package(Qt5Core) -find_package(Qt5Concurrent) # new in Qt5, from QtCore -find_package(Qt5Gui) # reduced, small version without widgets -find_package(Qt5Widgets) # widgets in their separate module -find_package(Qt5PrintSupport) -find_package(Qt5Xml) -find_package(Qt5XmlPatterns) -find_package(Qt5Svg) -find_package(Qt5Sql) -find_package(Qt5Designer) -find_package(Qt5UiTools) -find_package(Qt5Test) -find_package(Qt5Network) -find_package(Qt5WebKit) -find_package(Qt5WebKitWidgets) -find_package(Qt5OpenGL) -find_package(Qt5Script) -find_package(Qt5ScriptTools) -find_package(Qt5Help) -find_package(Qt5Multimedia) -find_package(Qt5Quick) -find_package(Qt5Qml) -find_package(Qt5QuickWidgets) -find_package(Qt5WebChannel) -find_package(Qt5WebEngine) -find_package(Qt5WebEngineWidgets) -find_package(Qt5WebSockets) - -if(UNIX AND NOT APPLE) - find_package(Qt5X11Extras) # new in Qt5, from QtGui -endif() - string(REGEX MATCHALL "[0-9]+" qt_version_helper "${Qt5Core_VERSION}") list(GET qt_version_helper 0 QT_VERSION_MAJOR) @@ -316,9 +284,12 @@ else() endif() add_subdirectory(libpyside) +find_package(Qt5UiTools) +find_package(Qt5Designer) if(Qt5UiTools_FOUND AND Qt5Designer_FOUND) add_subdirectory(plugins) endif() + # project directories add_subdirectory(PySide2) if (BUILD_TESTS) diff --git a/PySide2/CMakeLists.txt b/PySide2/CMakeLists.txt index 0fe42ce6..d016bc3a 100644 --- a/PySide2/CMakeLists.txt +++ b/PySide2/CMakeLists.txt @@ -2,64 +2,21 @@ project(pyside2) include(PySideModules) -find_package(Qt5Core) -find_package(Qt5Concurrent) -find_package(Qt5Gui) -find_package(Qt5Widgets) -find_package(Qt5PrintSupport) -find_package(Qt5Network) -find_package(Qt5WebKit) -find_package(Qt5WebKitWidgets) -find_package(Qt5Xml) -find_package(Qt5XmlPatterns) -find_package(Qt5Svg) -find_package(Qt5Test) -find_package(Qt5Sql) -find_package(Qt5Designer) -find_package(Qt5OpenGL) -find_package(Qt5UiTools) -find_package(Qt5Help) -find_package(Qt5Script) -find_package(Qt5ScriptTools) -find_package(Qt5Multimedia) -find_package(Qt5MultimediaWidgets) -find_package(Qt5Qml) -find_package(Qt5Quick) -find_package(Qt5QuickWidgets) -find_package(Qt5WebChannel) -find_package(Qt5WebEngine) -find_package(Qt5WebEngineWidgets) -find_package(Qt5WebSockets) - -if(UNIX AND NOT APPLE) - find_package(Qt5X11Extras) -endif() - -if(WIN32) - find_package(Qt5WinExtras) -endif() - -if(APPLE) - find_package(Qt5MacExtras) -endif() - -# Configure include based on platform -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in" - "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h" @ONLY) - -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in" - "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" @ONLY) - -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/_utils.py.in" - "${CMAKE_CURRENT_BINARY_DIR}/_utils.py" @ONLY) - -macro(CHECK_PACKAGE_FOUND name) +macro(COLLECT_MODULE_IF_FOUND shortname) + set(name "Qt5${shortname}") + find_package(${name}) set(_name_found "${name}_FOUND") if(${_name_found}) - message("module ${name} found") + message(STATUS "module ${name} found (${ARGN})") # Hoist this to the parent scope to make sure all tests get built set("${name}_FOUND" 1 PARENT_SCOPE) + # also put the module at the end of pyside2_global.h + file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h.add" + "#include \"Qt${shortname}/Qt${shortname}\"\n") + # record the shortnames for the tests + list(APPEND all_module_shortnames ${shortname}) + set(all_module_shortnames ${all_module_shortnames} PARENT_SCOPE) else() if("${ARGN}" STREQUAL "opt") message(STATUS "optional module ${name} skipped") @@ -72,98 +29,18 @@ macro(CHECK_PACKAGE_FOUND name) endif() endmacro() -##### -# This macro was needed to skip classes which did not build, yet. -# It replaces shiboken by a script that filters the missing classes -# away of the xxx_module_wrapper.cpp file. -# You can use it like so: -# -# skip_missing_classes(QtWidgets_SRC) -# create_pyside_module(QtWidgets -# ... -# - -macro(skip_missing_classes sources) - # this line signals postprocessing to macro "create_pyside_module". - set(${sources}_skipped_files 1) - # you just need to pass exactly the same sources variable. - string(REPLACE ";" "\n" _escaped_sources "${${sources}}") - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/filter_init.py" - "if True: # allow the indentation - files = '''\n${_escaped_sources}\n'''.strip().split('\\n') - import sys, os, re, pprint - pprint.pprint(files) - nset = set() - for fname in files: - name = os.path.splitext(os.path.basename(fname))[0] - print(name) - if name.endswith('module_wrapper'): - fn = fname - else: - name = name.split('_wrapper') - assert name[1] == '' - nset.add(name[0]) - print(fn) - with open(fn) as f: - lines = f.readlines() - removals = set() - for idx, line in enumerate(lines): - res = re.search(' init_(\\w+)', line) - if res and res.group(1).lower() not in nset: - removals.add(res.group(1)) - lines[idx] = '//' + line - with open(fn, 'w') as f: - f.writelines(lines) - removals = sorted(list(removals)) - print('Removals:', removals) - ") -endmacro() - -CHECK_PACKAGE_FOUND(Qt5Core) -CHECK_PACKAGE_FOUND(Qt5Concurrent essential) -CHECK_PACKAGE_FOUND(Qt5Gui essential) -CHECK_PACKAGE_FOUND(Qt5Widgets essential) -CHECK_PACKAGE_FOUND(Qt5PrintSupport essential) -CHECK_PACKAGE_FOUND(Qt5Xml) -CHECK_PACKAGE_FOUND(Qt5XmlPatterns opt) -CHECK_PACKAGE_FOUND(Qt5Svg opt) -CHECK_PACKAGE_FOUND(Qt5Sql essential) -CHECK_PACKAGE_FOUND(Qt5Designer opt) -CHECK_PACKAGE_FOUND(Qt5UiTools opt) -CHECK_PACKAGE_FOUND(Qt5Test essential) -CHECK_PACKAGE_FOUND(Qt5Network essential) -CHECK_PACKAGE_FOUND(Qt5WebKit opt) -CHECK_PACKAGE_FOUND(Qt5WebKitWidgets opt) -CHECK_PACKAGE_FOUND(Qt5Script opt) -CHECK_PACKAGE_FOUND(Qt5ScriptTools opt) -CHECK_PACKAGE_FOUND(Qt5Help opt) -CHECK_PACKAGE_FOUND(Qt5Multimedia opt) -CHECK_PACKAGE_FOUND(Qt5MultimediaWidgets opt) -CHECK_PACKAGE_FOUND(Qt5Qml opt) -CHECK_PACKAGE_FOUND(Qt5Quick opt) -CHECK_PACKAGE_FOUND(Qt5QuickWidgets opt) -CHECK_PACKAGE_FOUND(Qt5WebChannel opt) -CHECK_PACKAGE_FOUND(Qt5WebEngineWidgets opt) -CHECK_PACKAGE_FOUND(Qt5WebSockets opt) - -if(UNIX AND NOT APPLE) - CHECK_PACKAGE_FOUND(Qt5X11Extras opt) -endif() - -if(WIN32) - CHECK_PACKAGE_FOUND(Qt5WinExtras opt) -endif() - -if(APPLE) - CHECK_PACKAGE_FOUND(Qt5MacExtras opt) -endif() - # note: the order of this list is relevant for dependencies. -# For instance: Qt5Printsupport must come before Qt5WebKitWidgets -HAS_QT_MODULE(Qt5Core_FOUND QtCore) +# For instance: Qt5Printsupport must come before Qt5WebKitWidgets. +COLLECT_MODULE_IF_FOUND(Core) +COLLECT_MODULE_IF_FOUND(Gui essential) +COLLECT_MODULE_IF_FOUND(Widgets essential) +COLLECT_MODULE_IF_FOUND(PrintSupport essential) +COLLECT_MODULE_IF_FOUND(Sql essential) +COLLECT_MODULE_IF_FOUND(Network essential) +COLLECT_MODULE_IF_FOUND(Test essential) if(NOT MSVC) # right now this does not build on windows - HAS_QT_MODULE(Qt5Concurrent_FOUND QtConcurrent) + COLLECT_MODULE_IF_FOUND(Concurrent essential) else() # Note: in order to use this variable in a sibling project (tests), # we need to either make the value persistent like so: @@ -172,61 +49,71 @@ else() # This is preferable, because there are no sticky side effects. set(DISABLE_QtConcurrent 1 PARENT_SCOPE) ENDIF() -HAS_QT_MODULE(Qt5Gui_FOUND QtGui) -HAS_QT_MODULE(Qt5Widgets_FOUND QtWidgets) -# This module is deprecated and should be replaces by QtGui. -# See http://doc.qt.io/qt-5/qtgui-index.html -# Update: We support QtOpenGL now! -# Note: The dependency is wrong: QtWidgets is needed! -HAS_QT_MODULE(Qt5OpenGL_FOUND QtOpenGL) -HAS_QT_MODULE(Qt5PrintSupport_FOUND QtPrintSupport) -HAS_QT_MODULE(Qt5Svg_FOUND QtSvg) -HAS_QT_MODULE(Qt5Sql_FOUND QtSql) -HAS_QT_MODULE(Qt5Network_FOUND QtNetwork) -HAS_QT_MODULE(Qt5Xml_FOUND QtXml) -HAS_QT_MODULE(Qt5XmlPatterns_FOUND QtXmlPatterns) -HAS_QT_MODULE(Qt5Test_FOUND QtTest) -HAS_QT_MODULE(Qt5WebKit_FOUND QtWebKit) +if(UNIX AND NOT APPLE) + COLLECT_MODULE_IF_FOUND(X11Extras essential) +endif() +if(WIN32) + COLLECT_MODULE_IF_FOUND(WinExtras essential) +endif() +if(APPLE) + COLLECT_MODULE_IF_FOUND(MacExtras essential) +endif() +COLLECT_MODULE_IF_FOUND(Xml) +COLLECT_MODULE_IF_FOUND(XmlPatterns opt) +COLLECT_MODULE_IF_FOUND(Help opt) +COLLECT_MODULE_IF_FOUND(Multimedia opt) +COLLECT_MODULE_IF_FOUND(MultimediaWidgets opt) +COLLECT_MODULE_IF_FOUND(OpenGL opt) +COLLECT_MODULE_IF_FOUND(Qml opt) +COLLECT_MODULE_IF_FOUND(Quick opt) +COLLECT_MODULE_IF_FOUND(QuickWidgets opt) +COLLECT_MODULE_IF_FOUND(Script opt) if(NOT MSVC) # right now this does not build on windows - HAS_QT_MODULE(Qt5WebKitWidgets_FOUND QtWebKitWidgets) + COLLECT_MODULE_IF_FOUND(ScriptTools opt) else() - set(DISABLE_QtWebKitWidgets 1 PARENT_SCOPE) + set(DISABLE_QtScriptTools 1 PARENT_SCOPE) ENDIF() - +COLLECT_MODULE_IF_FOUND(Svg opt) if(Qt5Designer_FOUND) - HAS_QT_MODULE(Qt5UiTools_FOUND QtUiTools) + COLLECT_MODULE_IF_FOUND(UiTools opt) else() set(DISABLE_QtUiTools 1 PARENT_SCOPE) endif() -HAS_QT_MODULE(Qt5Script_FOUND QtScript) +COLLECT_MODULE_IF_FOUND(WebChannel opt) +# still forgotten: +#COLLECT_MODULE_IF_FOUND(WebEngineCore opt) +#COLLECT_MODULE_IF_FOUND(WebEngine opt) +COLLECT_MODULE_IF_FOUND(WebEngineWidgets opt) +COLLECT_MODULE_IF_FOUND(WebKit opt) if(NOT MSVC) # right now this does not build on windows - HAS_QT_MODULE(Qt5ScriptTools_FOUND QtScriptTools) + COLLECT_MODULE_IF_FOUND(WebKitWidgets opt) else() - set(DISABLE_QtScriptTools 1 PARENT_SCOPE) + set(DISABLE_QtWebKitWidgets 1 PARENT_SCOPE) ENDIF() -HAS_QT_MODULE(Qt5Help_FOUND QtHelp) -HAS_QT_MODULE(Qt5Multimedia_FOUND QtMultimedia) -HAS_QT_MODULE(Qt5MultimediaWidgets_FOUND QtMultimediaWidgets) -HAS_QT_MODULE(Qt5Qml_FOUND QtQml) -HAS_QT_MODULE(Qt5Quick_FOUND QtQuick) -HAS_QT_MODULE(Qt5QuickWidgets_FOUND QtQuickWidgets) -HAS_QT_MODULE(Qt5WebChannel_FOUND QtWebChannel) -HAS_QT_MODULE(Qt5WebEngineWidgets_FOUND QtWebEngineWidgets) -HAS_QT_MODULE(Qt5WebSockets_FOUND QtWebSockets) +COLLECT_MODULE_IF_FOUND(WebSockets opt) -if(UNIX AND NOT APPLE) - has_qt_module(Qt5X11Extras_FOUND QtX11Extras) -endif() +# Configure include based on platform +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h" @ONLY) -if(WIN32) - has_qt_module(Qt5WinExtras_FOUND QtWinExtras) -endif() +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in" + "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" @ONLY) -if(APPLE) - has_qt_module(Qt5MacExtras_FOUND QtMacExtras) -endif() +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/_utils.py.in" + "${CMAKE_CURRENT_BINARY_DIR}/_utils.py" @ONLY) + +# Add the collected includes to the global include +file(READ "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h.add" GLOBAL_APPEND) +file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h" "${GLOBAL_APPEND}") +file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h.add") + +# now compile all modules. +foreach(shortname IN LISTS all_module_shortnames) + set(name "Qt5${shortname}") + HAS_QT_MODULE(${name}_FOUND Qt${shortname}) +endforeach() # install install(FILES "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" diff --git a/PySide2/global.h.in b/PySide2/global.h.in index 020c9c19..6bddcfcc 100644 --- a/PySide2/global.h.in +++ b/PySide2/global.h.in @@ -384,97 +384,45 @@ QT_END_NAMESPACE #define QT_NO_DEBUG #include -#include #if @ENABLE_MAC@ || @ENABLE_WIN@ || @ENABLE_X11@ // Workaround to parse the QApplication header #define Q_INTERNAL_QAPP_SRC #undef Q_QDOC #endif -#include -#include +#if @Qt5Gui_FOUND@ +# include +#endif +#if @Qt5Widgets_FOUND@ +# include +#endif #ifndef Q_QDOC // Make sure that Q_QDOC is defined for as much modules as possible. // This creates more wrappers without extra work. // Will disappear when we have a really good parser! # define Q_QDOC #endif -#include + #include "qpytextobject.h" // PySide class + #if @ENABLE_X11@ -#if @Qt5X11Extras_FOUND@ -#include -#endif +# if @Qt5X11Extras_FOUND@ +# include +# endif #elif @ENABLE_MAC@ - #include +# include #endif -#include -#include -#include -#include -#include -#include -#include -#include // QT_WIDGETS_LIB must be defined to QSqlRelationalDelegate become visible. // It also changes code generation in pysideqtesttouch.h #define QT_WIDGETS_LIB #undef Q_DECLARE_INTERFACE -#include -#include -#if @Qt5WebKit_FOUND@ -# include -#endif - -#if @Qt5WebKitWidgets_FOUND@ -# include -#endif #if @Qt5Test_FOUND@ -# include # include "pysideqtesttouch.h" #endif -#if @Qt5Quick_FOUND@ -# include -#endif - -#if @Qt5Qml_FOUND@ -# include -#endif - -#if @Qt5QuickWidgets_FOUND@ -# include -#endif - -#if @Qt5WebEngineWidgets_FOUND@ -# include -#endif - -#if @Qt5MultimediaWidgets_FOUND@ -# include -#endif - -#if @Qt5WebChannel_FOUND@ -# include -#endif - -#if @Qt5WebSockets_FOUND@ -# include -#endif - -#if @Qt5WinExtras_FOUND@ -# include -#endif - -#if @Qt5MacExtras_FOUND@ -# include -#endif - -//QtHelp needs to be included after QtSql. Why? -#include - #ifndef QT_NO_OPENGL -#include <@GL_H@> -#include +# include <@GL_H@> #endif // QT_NO_OPENGL + +// Here are now all configured modules appended: diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5fe2d7db..2b7e3b0e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -49,46 +49,10 @@ else() add_subdirectory(pysidetest) add_subdirectory(signals) - TEST_QT_MODULE(Qt5Core_FOUND QtCore) - TEST_QT_MODULE(Qt5Concurrent_FOUND QtConcurrent) - TEST_QT_MODULE(Qt5Gui_FOUND QtGui) - TEST_QT_MODULE(Qt5Widgets_FOUND QtWidgets) - TEST_QT_MODULE(Qt5PrintSupport_FOUND QtPrintSupport) - TEST_QT_MODULE(Qt5Network_FOUND QtNetwork) - TEST_QT_MODULE(Qt5WebKit_FOUND QtWebKit) - TEST_QT_MODULE(Qt5WebKitWidgets_FOUND QtWebKitWidgets) - TEST_QT_MODULE(Qt5Xml_FOUND QtXml) - TEST_QT_MODULE(Qt5XmlPatterns_FOUND QtXmlPatterns) - TEST_QT_MODULE(Qt5Svg_FOUND QtSvg) - TEST_QT_MODULE(Qt5Test_FOUND QtTest) - TEST_QT_MODULE(Qt5Sql_FOUND QtSql) - #TEST_QT_MODULE(Qt5Designer_FOUND QtDesigner) - TEST_QT_MODULE(Qt5OpenGL_FOUND QtOpenGL) - TEST_QT_MODULE(Qt5UiTools_FOUND QtUiTools) - TEST_QT_MODULE(Qt5Help_FOUND QtHelp) - TEST_QT_MODULE(Qt5Script_FOUND QtScript) - TEST_QT_MODULE(Qt5ScriptTools_FOUND QtScriptTools) - TEST_QT_MODULE(Qt5Multimedia_FOUND QtMultimedia) - TEST_QT_MODULE(Qt5MultimediaWidgets_FOUND QtMultimediaWidgets) - TEST_QT_MODULE(Qt5Qml_FOUND QtQml) - TEST_QT_MODULE(Qt5Quick_FOUND QtQuick) - TEST_QT_MODULE(Qt5QuickWidgets_FOUND QtQuickWidgets) - TEST_QT_MODULE(Qt5WebChannel_FOUND QtWebChannel) - #TEST_QT_MODULE(Qt5WebEngine_FOUND QtWebEngine) - TEST_QT_MODULE(Qt5WebEngineWidgets_FOUND QtWebEngineWidgets) - TEST_QT_MODULE(Qt5WebSockets_FOUND QtWebSockets) - - if(UNIX AND NOT APPLE) - TEST_QT_MODULE(Qt5X11Extras_FOUND QtX11Extras) - endif() - - if(WIN32) - TEST_QT_MODULE(Qt5WinExtras_FOUND QtWinExtras) - endif() - - if(APPLE) - TEST_QT_MODULE(Qt5MacExtras_FOUND QtMacExtras) - endif() + foreach(shortname IN LISTS all_module_shortnames) + message(STATUS "preparing tests for module 'Qt${shortname}'") + TEST_QT_MODULE(Qt5${shortname}_FOUND Qt${shortname}) + endforeach() #platform specific if (ENABLE_MAC) -- cgit v1.2.3