aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-05-02 19:50:49 +0800
committerLiang Qi <liang.qi@qt.io>2017-05-03 07:41:30 +0000
commit19aed1b523203754edbac049f68d4a012a5c954d (patch)
treeb7d28541d0031b9cb99410321b44d16c1283f00c
parent2e9f955a086fa7676c9eda60ca9e28cc03d9c5e2 (diff)
Add support for Qt Win Extras module
Task-number: PYSIDE-487 Change-Id: Ie7cb4df3900fca36b0ef4747f351ab0600d8f45c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--PySide2/CMakeLists.txt12
-rw-r--r--PySide2/QtWinExtras/CMakeLists.txt51
-rw-r--r--PySide2/QtWinExtras/typesystem_winextras.xml61
-rw-r--r--PySide2/global.h.in4
-rw-r--r--tests/CMakeLists.txt4
-rw-r--r--tests/QtWinExtras/CMakeLists.txt1
-rw-r--r--tests/QtWinExtras/this_module_loads_test.py39
7 files changed, 172 insertions, 0 deletions
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 @@
+<?xml version="1.0"?>
+<!--
+/****************************************************************************
+**
+** Copyright (C) 2017 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$
+**
+****************************************************************************/
+-->
+<typesystem package="PySide2.QtWinExtras">
+ <load-typesystem name="typesystem_core.xml" generate="no"/>
+ <load-typesystem name="typesystem_gui.xml" generate="no"/>
+
+ <object-type name="QWinEvent" since="5.2"/>
+ <object-type name="QWinColorizationChangeEvent" since="5.2"/>
+ <object-type name="QWinCompositionChangeEvent" since="5.2"/>
+ <object-type name="QWinJumpList" since="5.2"/>
+ <object-type name="QWinJumpListCategory" since="5.2">
+ <enum-type name="Type"/>
+ </object-type>
+ <object-type name="QWinJumpListItem" since="5.2">
+ <enum-type name="Type"/>
+ </object-type>
+ <!-- <object-type name="QWinMime" since="5.4"/> -->
+ <object-type name="QWinTaskbarButton" since="5.2"/>
+ <object-type name="QWinTaskbarProgress" since="5.2"/>
+ <object-type name="QWinThumbnailToolBar" since="5.2"/>
+ <object-type name="QWinThumbnailToolButton" since="5.2"/>
+</typesystem>
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 <QtWebSockets/QtWebSockets>
#endif
+#if @Qt5WinExtras_FOUND@
+# include <QtWinExtras/QtWinExtras>
+#endif
+
//QtHelp needs to be included after QtSql. Why?
#include <QtHelp/QtHelp>
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