aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2017-05-18 18:45:41 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2017-05-19 08:58:44 +0000
commit5e507c6ead2457ae863ce4d6bf1710ef02fac892 (patch)
tree86c9f43cd7c2c8e60189e86c9b922f1c0015655b
parent2abd4235538e232588a248bcf6996e2df9062c85 (diff)
Properly differentiate between QML support and private API QML support
This change introduces proper differentiation between finding the QML headers, and finding the QML private API headers. The public headers are used for proper QQuickItem subclass registration, while the the private headers are used for converting QML exceptions to Python exceptions. Task-number: PYSIDE-489 Change-Id: Ia36afcb2013a3cf489c6e9ab35917c50ddf313a6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--libpyside/CMakeLists.txt42
-rw-r--r--libpyside/signalmanager.cpp.in4
2 files changed, 27 insertions, 19 deletions
diff --git a/libpyside/CMakeLists.txt b/libpyside/CMakeLists.txt
index 7b8e003f..b740e403 100644
--- a/libpyside/CMakeLists.txt
+++ b/libpyside/CMakeLists.txt
@@ -1,32 +1,40 @@
project(libpyside)
if(${Qt5Qml_FOUND})
-if(NOT "${Qt5Qml_PRIVATE_INCLUDE_DIRS}" MATCHES "/QtQml/")
- string(REPLACE "/QtCore" "/QtQml" replaceme "${Qt5Core_PRIVATE_INCLUDE_DIRS}")
- list(APPEND Qt5Qml_PRIVATE_INCLUDE_DIRS ${replaceme})
- list(REMOVE_DUPLICATES Qt5Qml_PRIVATE_INCLUDE_DIRS)
-endif()
+ if(NOT "${Qt5Qml_PRIVATE_INCLUDE_DIRS}" MATCHES "/QtQml/")
+ string(REPLACE "/QtCore" "/QtQml" replaceme "${Qt5Core_PRIVATE_INCLUDE_DIRS}")
+ list(APPEND Qt5Qml_PRIVATE_INCLUDE_DIRS ${replaceme})
+ list(REMOVE_DUPLICATES Qt5Qml_PRIVATE_INCLUDE_DIRS)
+ endif()
endif()
+
if(${Qt5Quick_FOUND})
-if(NOT "${Qt5Quick_PRIVATE_INCLUDE_DIRS}" MATCHES "/QtQuick/")
- string(REPLACE "/QtCore" "/QtQuick" replaceme "${Qt5Core_PRIVATE_INCLUDE_DIRS}")
- list(APPEND Qt5Quick_PRIVATE_INCLUDE_DIRS ${Qt5Qml_PRIVATE_INCLUDE_DIRS})
- list(APPEND Qt5Quick_PRIVATE_INCLUDE_DIRS ${replaceme})
- list(REMOVE_DUPLICATES Qt5Quick_PRIVATE_INCLUDE_DIRS)
-endif()
+ if(NOT "${Qt5Quick_PRIVATE_INCLUDE_DIRS}" MATCHES "/QtQuick/")
+ string(REPLACE "/QtCore" "/QtQuick" replaceme "${Qt5Core_PRIVATE_INCLUDE_DIRS}")
+ list(APPEND Qt5Quick_PRIVATE_INCLUDE_DIRS ${Qt5Qml_PRIVATE_INCLUDE_DIRS})
+ list(APPEND Qt5Quick_PRIVATE_INCLUDE_DIRS ${replaceme})
+ list(REMOVE_DUPLICATES Qt5Quick_PRIVATE_INCLUDE_DIRS)
+ endif()
endif()
-if(Qt5Qml_FOUND AND Qt5Qml_PRIVATE_INCLUDE_DIRS)
- set(QML_INCLUDES ${Qt5Qml_INCLUDE_DIRS} ${Qt5Qml_PRIVATE_INCLUDE_DIRS})
+if(Qt5Qml_FOUND)
+ # Used for registering custom QQuickItem classes defined in Python code.
+ set(QML_SUPPORT 1)
+ set(QML_INCLUDES ${Qt5Qml_INCLUDE_DIRS})
set(QML_LIBRARIES ${Qt5Qml_LIBRARIES})
- set(QML_SUPPORT 1)
+ if(Qt5Qml_PRIVATE_INCLUDE_DIRS)
+ # Used for transforming QML exceptions into Python exceptions.
+ set(QML_PRIVATE_API_SUPPORT 1)
+ set(QML_INCLUDES ${QML_INCLUDES} ${Qt5Qml_PRIVATE_INCLUDE_DIRS})
+ else()
+ set(QML_PRIVATE_API_SUPPORT 0)
+ message(WARNING "QML private API include files could not be found, support for catching QML exceptions inside Python code will not work.")
+ endif()
else()
- message(WARNING "QML private include files could not be found, support for catching QML exceptions inside Python code will not work.")
+ set(QML_SUPPORT 0)
set(QML_INCLUDES "")
set(QML_LIBRARIES "")
-
- set(QML_SUPPORT 0)
endif()
qt5_wrap_cpp(DESTROYLISTENER_MOC "destroylistener.h")
diff --git a/libpyside/signalmanager.cpp.in b/libpyside/signalmanager.cpp.in
index d6757efb..473057cb 100644
--- a/libpyside/signalmanager.cpp.in
+++ b/libpyside/signalmanager.cpp.in
@@ -61,7 +61,7 @@
#include <conversions.h>
// These private headers are needed to throw JavaScript exceptions
-#if @QML_SUPPORT@
+#if @QML_PRIVATE_API_SUPPORT@
#include <private/qv4engine_p.h>
#include <private/qv4context_p.h>
#include <private/qqmldata_p.h>
@@ -489,7 +489,7 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
if (PyErr_Occurred()) {
-#if @QML_SUPPORT@
+#if @QML_PRIVATE_API_SUPPORT@
// This JS engine grabber based off of Qt 5.5's `qjsEngine` function
QQmlData *data = QQmlData::get(object, false);