aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-07-17 08:06:56 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-07-20 13:11:48 +0000
commit7f13c0d0094cf70d85c5859db019c62fb35d2dae (patch)
tree187da3cbb960cf1a335cc61a77e4117d5a182ce4 /sources/pyside2
parentac67527ab94a4da2dfaee7567a956b474a46c5e3 (diff)
Re-add QtSvg
QtSvg was split into QtSvg and QtSvgWidgets in Qt 6. Adapt the PySide2 modules accordingly. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Task-number: QTBUG-41884 Change-Id: I4ff005dfc6e71ac8eb3e3d45b22a7e507eb88f6d Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2')
-rw-r--r--sources/pyside2/PySide2/QtSvg/CMakeLists.txt7
-rw-r--r--sources/pyside2/PySide2/QtSvg/typesystem_svg.xml17
-rw-r--r--sources/pyside2/PySide2/QtSvgWidgets/CMakeLists.txt39
-rw-r--r--sources/pyside2/PySide2/QtSvgWidgets/typesystem_svgwidgets.xml60
-rw-r--r--sources/pyside2/tests/QtSvg/CMakeLists.txt1
-rw-r--r--sources/pyside2/tests/QtSvg/qsvgrenderer_test.py10
-rw-r--r--sources/pyside2/tests/QtSvgWidgets/CMakeLists.txt1
-rw-r--r--sources/pyside2/tests/QtSvgWidgets/qsvgwidget_test.py (renamed from sources/pyside2/tests/QtSvg/qsvgwidget_test.py)12
8 files changed, 115 insertions, 32 deletions
diff --git a/sources/pyside2/PySide2/QtSvg/CMakeLists.txt b/sources/pyside2/PySide2/QtSvg/CMakeLists.txt
index 19768274d..34f72219e 100644
--- a/sources/pyside2/PySide2/QtSvg/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtSvg/CMakeLists.txt
@@ -1,10 +1,8 @@
project(QtSvg)
set(QtSvg_SRC
-${QtSvg_GEN_DIR}/qgraphicssvgitem_wrapper.cpp
${QtSvg_GEN_DIR}/qsvggenerator_wrapper.cpp
${QtSvg_GEN_DIR}/qsvgrenderer_wrapper.cpp
-${QtSvg_GEN_DIR}/qsvgwidget_wrapper.cpp
# module is always needed
${QtSvg_GEN_DIR}/qtsvg_module_wrapper.cpp
)
@@ -13,20 +11,17 @@ set(QtSvg_include_dirs ${QtSvg_SOURCE_DIR}
${QtSvg_BINARY_DIR}
${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS}
${Qt${QT_MAJOR_VERSION}Gui_INCLUDE_DIRS}
- ${Qt${QT_MAJOR_VERSION}Widgets_INCLUDE_DIRS}
${Qt${QT_MAJOR_VERSION}Svg_INCLUDE_DIRS}
${libpyside_SOURCE_DIR}
${QtCore_GEN_DIR}
${QtGui_GEN_DIR}
- ${QtWidgets_GEN_DIR}
)
set(QtSvg_libraries pyside2
${Qt${QT_MAJOR_VERSION}Core_LIBRARIES}
${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Widgets_LIBRARIES}
${Qt${QT_MAJOR_VERSION}Svg_LIBRARIES}
)
-set(QtSvg_deps QtWidgets)
+set(QtSvg_deps QtGui)
create_pyside_module(NAME QtSvg
INCLUDE_DIRS QtSvg_include_dirs
diff --git a/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml b/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml
index 079a79e96..c921c631e 100644
--- a/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml
+++ b/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml
@@ -2,7 +2,7 @@
<!--
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
@@ -40,10 +40,9 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtSvg">
- <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
<object-type name="QSvgRenderer"/>
- <object-type name="QSvgWidget"/>
<object-type name="QSvgGenerator">
<modify-function signature="setOutputDevice(QIODevice*)">
@@ -59,16 +58,4 @@
</modify-function>
</object-type>
- <object-type name="QGraphicsSvgItem">
- <modify-function signature="QGraphicsSvgItem(QGraphicsItem*)">
- <modify-argument index="this">
- <parent index="1" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="QGraphicsSvgItem(const QString&amp;,QGraphicsItem*)">
- <modify-argument index="this">
- <parent index="2" action="add"/>
- </modify-argument>
- </modify-function>
- </object-type>
</typesystem>
diff --git a/sources/pyside2/PySide2/QtSvgWidgets/CMakeLists.txt b/sources/pyside2/PySide2/QtSvgWidgets/CMakeLists.txt
new file mode 100644
index 000000000..e04d5194b
--- /dev/null
+++ b/sources/pyside2/PySide2/QtSvgWidgets/CMakeLists.txt
@@ -0,0 +1,39 @@
+project(QtSvgWidgets)
+
+set(QtSvgWidgets_SRC
+${QtSvgWidgets_GEN_DIR}/qgraphicssvgitem_wrapper.cpp
+${QtSvgWidgets_GEN_DIR}/qsvgwidget_wrapper.cpp
+# module is always needed
+${QtSvgWidgets_GEN_DIR}/qtsvgwidgets_module_wrapper.cpp
+)
+
+set(QtSvgWidgets_include_dirs ${QtSvgWidgets_SOURCE_DIR}
+ ${QtSvgWidgets_BINARY_DIR}
+ ${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS}
+ ${Qt${QT_MAJOR_VERSION}Gui_INCLUDE_DIRS}
+ ${Qt${QT_MAJOR_VERSION}Widgets_INCLUDE_DIRS}
+ ${Qt${QT_MAJOR_VERSION}Svg_INCLUDE_DIRS}
+ ${Qt${QT_MAJOR_VERSION}SvgWidgets_INCLUDE_DIRS}
+ ${libpyside_SOURCE_DIR}
+ ${QtCore_GEN_DIR}
+ ${QtGui_GEN_DIR}
+ ${QtWidgets_GEN_DIR}
+ ${QtSvg_GEN_DIR}
+ )
+
+set(QtSvgWidgets_libraries pyside2
+ ${Qt${QT_MAJOR_VERSION}Core_LIBRARIES}
+ ${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES}
+ ${Qt${QT_MAJOR_VERSION}Widgets_LIBRARIES}
+ ${Qt${QT_MAJOR_VERSION}Svg_LIBRARIES}
+ ${Qt${QT_MAJOR_VERSION}SvgWidgets_LIBRARIES}
+ )
+
+set(QtSvgWidgets_deps QtSvg QtWidgets)
+
+create_pyside_module(NAME QtSvgWidgets
+ INCLUDE_DIRS QtSvgWidgets_include_dirs
+ LIBRARIES QtSvgWidgets_libraries
+ DEPS QtSvgWidgets_deps
+ TYPESYSTEM_PATH QtSvgWidgets_SOURCE_DIR
+ SOURCES QtSvgWidgets_SRC)
diff --git a/sources/pyside2/PySide2/QtSvgWidgets/typesystem_svgwidgets.xml b/sources/pyside2/PySide2/QtSvgWidgets/typesystem_svgwidgets.xml
new file mode 100644
index 000000000..a6aa5b922
--- /dev/null
+++ b/sources/pyside2/PySide2/QtSvgWidgets/typesystem_svgwidgets.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $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$
+**
+****************************************************************************/
+-->
+<typesystem package="PySide2.QtSvgWidgets">
+ <load-typesystem name="QtSvg/typesystem_svg.xml" generate="no"/>
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
+
+ <object-type name="QSvgWidget"/>
+
+ <object-type name="QGraphicsSvgItem">
+ <modify-function signature="QGraphicsSvgItem(QGraphicsItem*)">
+ <modify-argument index="this">
+ <parent index="1" action="add"/>
+ </modify-argument>
+ </modify-function>
+ <modify-function signature="QGraphicsSvgItem(const QString&amp;,QGraphicsItem*)">
+ <modify-argument index="this">
+ <parent index="2" action="add"/>
+ </modify-argument>
+ </modify-function>
+ </object-type>
+</typesystem>
diff --git a/sources/pyside2/tests/QtSvg/CMakeLists.txt b/sources/pyside2/tests/QtSvg/CMakeLists.txt
index 4f5e2805f..53d15e857 100644
--- a/sources/pyside2/tests/QtSvg/CMakeLists.txt
+++ b/sources/pyside2/tests/QtSvg/CMakeLists.txt
@@ -1,3 +1,2 @@
PYSIDE_TEST(qsvggenerator_test.py)
PYSIDE_TEST(qsvgrenderer_test.py)
-PYSIDE_TEST(qsvgwidget_test.py)
diff --git a/sources/pyside2/tests/QtSvg/qsvgrenderer_test.py b/sources/pyside2/tests/QtSvg/qsvgrenderer_test.py
index 88537edfe..3dd5b61f6 100644
--- a/sources/pyside2/tests/QtSvg/qsvgrenderer_test.py
+++ b/sources/pyside2/tests/QtSvg/qsvgrenderer_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2020 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -36,15 +36,15 @@ 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.QtCore import *
-from PySide2.QtWidgets import *
-from PySide2.QtSvg import *
+from PySide2.QtCore import QFile
+from PySide2.QtGui import QGuiApplication
+from PySide2.QtSvg import QSvgRenderer
class QSvgRendererTest(unittest.TestCase):
def testLoad(self):
tigerPath = os.path.join(os.path.dirname(__file__), 'tiger.svg')
- app = QApplication([])
+ app = QGuiApplication([])
fromFile = QSvgRenderer(tigerPath)
self.assertTrue(fromFile.isValid())
diff --git a/sources/pyside2/tests/QtSvgWidgets/CMakeLists.txt b/sources/pyside2/tests/QtSvgWidgets/CMakeLists.txt
new file mode 100644
index 000000000..61952169a
--- /dev/null
+++ b/sources/pyside2/tests/QtSvgWidgets/CMakeLists.txt
@@ -0,0 +1 @@
+PYSIDE_TEST(qsvgwidget_test.py)
diff --git a/sources/pyside2/tests/QtSvg/qsvgwidget_test.py b/sources/pyside2/tests/QtSvgWidgets/qsvgwidget_test.py
index 17bf6527b..a3749c0ee 100644
--- a/sources/pyside2/tests/QtSvg/qsvgwidget_test.py
+++ b/sources/pyside2/tests/QtSvgWidgets/qsvgwidget_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2020 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -36,14 +36,16 @@ 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.QtCore import *
-from PySide2.QtWidgets import *
-from PySide2.QtSvg import *
+from PySide2.QtCore import QFile, QFileInfo, QDir
+from PySide2.QtWidgets import QApplication
+from PySide2.QtSvgWidgets import QSvgWidget
class QSvgWidgetTest(unittest.TestCase):
def testLoad(self):
- tigerPath = os.path.join(os.path.dirname(__file__), 'tiger.svg')
+ dir = os.path.dirname(__file__)
+ tigerPath = QDir.cleanPath("{}/../QtSvg/tiger.svg".format(dir))
+ self.assertTrue(QFileInfo.exists(tigerPath))
app = QApplication([])
fromFile = QSvgWidget()