aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-11-18 15:05:17 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-12-08 08:48:50 +0100
commit862948599999e4e5701452a3f479182606e16a89 (patch)
tree585769e3cc6891334ab340ff82c16e7352e41b06 /sources/pyside6
parent244477a81445bf6f38cda3f8fe213daaa5908166 (diff)
Move the QML registration code into a library
This makes the code easier to maintain. Task-number: PYSIDE-1709 Change-Id: Idb75143a7e6d218637ab75463db88b6135cd4086 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6')
-rw-r--r--sources/pyside6/CMakeLists.txt5
-rw-r--r--sources/pyside6/PySide6/QtQml/CMakeLists.txt9
-rw-r--r--sources/pyside6/PySide6/QtQml/typesystem_qml.xml7
-rw-r--r--sources/pyside6/PySide6/glue/qtqml.cpp4
-rw-r--r--sources/pyside6/cmake/Macros/PySideModules.cmake2
-rw-r--r--sources/pyside6/cmake/PySideSetup.cmake2
-rw-r--r--sources/pyside6/libpysideqml/CMakeLists.txt85
-rw-r--r--sources/pyside6/libpysideqml/PySide6QmlConfig-spec.cmake.in7
-rw-r--r--sources/pyside6/libpysideqml/PySide6QmlConfig.cmake.in5
-rw-r--r--sources/pyside6/libpysideqml/PySide6QmlConfigVersion.cmake.in10
-rw-r--r--sources/pyside6/libpysideqml/pysideqml.cpp58
-rw-r--r--sources/pyside6/libpysideqml/pysideqml.h54
-rw-r--r--sources/pyside6/libpysideqml/pysideqmllistproperty.cpp (renamed from sources/pyside6/PySide6/QtQml/pysideqmllistproperty.cpp)2
-rw-r--r--sources/pyside6/libpysideqml/pysideqmllistproperty_p.h (renamed from sources/pyside6/PySide6/QtQml/pysideqmllistproperty.h)0
-rw-r--r--sources/pyside6/libpysideqml/pysideqmlmacros.h54
-rw-r--r--sources/pyside6/libpysideqml/pysideqmlmetacallerror.cpp (renamed from sources/pyside6/PySide6/QtQml/pysideqmlmetacallerror.cpp)1
-rw-r--r--sources/pyside6/libpysideqml/pysideqmlmetacallerror_p.h (renamed from sources/pyside6/PySide6/QtQml/pysideqmlmetacallerror_p.h)0
-rw-r--r--sources/pyside6/libpysideqml/pysideqmlregistertype.cpp (renamed from sources/pyside6/PySide6/QtQml/pysideqmlregistertype.cpp)0
-rw-r--r--sources/pyside6/libpysideqml/pysideqmlregistertype.h (renamed from sources/pyside6/PySide6/QtQml/pysideqmlregistertype.h)27
-rw-r--r--sources/pyside6/libpysideqml/pysideqmlregistertype_p.h (renamed from sources/pyside6/PySide6/QtQml/pysideqmlregistertype_p.h)0
-rw-r--r--sources/pyside6/libpysideqml/pysideqmluncreatable.cpp (renamed from sources/pyside6/PySide6/QtQml/pysideqmluncreatable.cpp)0
-rw-r--r--sources/pyside6/libpysideqml/pysideqmluncreatable.h (renamed from sources/pyside6/PySide6/QtQml/pysideqmluncreatable.h)0
-rw-r--r--sources/pyside6/tests/init_paths.py3
23 files changed, 306 insertions, 29 deletions
diff --git a/sources/pyside6/CMakeLists.txt b/sources/pyside6/CMakeLists.txt
index 4fc668ea5..c24777f36 100644
--- a/sources/pyside6/CMakeLists.txt
+++ b/sources/pyside6/CMakeLists.txt
@@ -9,6 +9,11 @@ project(pysidebindings)
include(cmake/PySideSetup.cmake)
add_subdirectory(libpyside)
+
+if(Qt${QT_MAJOR_VERSION}Qml_FOUND)
+ add_subdirectory(libpysideqml)
+endif()
+
find_package(Qt${QT_MAJOR_VERSION}Designer)
if(Qt${QT_MAJOR_VERSION}UiTools_FOUND AND Qt${QT_MAJOR_VERSION}Designer_FOUND)
add_subdirectory(plugins/uitools)
diff --git a/sources/pyside6/PySide6/QtQml/CMakeLists.txt b/sources/pyside6/PySide6/QtQml/CMakeLists.txt
index 05a1cc94a..4d8b88330 100644
--- a/sources/pyside6/PySide6/QtQml/CMakeLists.txt
+++ b/sources/pyside6/PySide6/QtQml/CMakeLists.txt
@@ -1,10 +1,6 @@
project(QtQml)
-set(QtQml_static_sources "${QtQml_SOURCE_DIR}/pysideqmlregistertype.cpp"
- "${QtQml_SOURCE_DIR}/pysideqmlmetacallerror.cpp"
- "${QtQml_SOURCE_DIR}/pysideqmllistproperty.cpp"
- "${QtQml_SOURCE_DIR}/pysideqmluncreatable.cpp"
- "${QtQml_SOURCE_DIR}/pysideqmlvolatilebool.cpp")
+set(QtQml_static_sources "${QtQml_SOURCE_DIR}/pysideqmlvolatilebool.cpp")
set(QtQml_SRC
${QtQml_GEN_DIR}/qjsengine_wrapper.cpp
@@ -47,11 +43,12 @@ set(QtQml_include_dirs ${QtQml_SOURCE_DIR}
${Qt${QT_MAJOR_VERSION}Qml_INCLUDE_DIRS}
${Qt${QT_MAJOR_VERSION}Qml_PRIVATE_INCLUDE_DIRS}
${libpyside_SOURCE_DIR}
+ ${libpysideqml_SOURCE_DIR}
${QtCore_GEN_DIR}
${QtNetwork_GEN_DIR}
${QtQml_GEN_DIR})
-set(QtQml_libraries pyside6
+set(QtQml_libraries pyside6 pyside6qml
${Qt${QT_MAJOR_VERSION}Core_LIBRARIES}
${Qt${QT_MAJOR_VERSION}Network_LIBRARIES}
${Qt${QT_MAJOR_VERSION}Qml_LIBRARIES})
diff --git a/sources/pyside6/PySide6/QtQml/typesystem_qml.xml b/sources/pyside6/PySide6/QtQml/typesystem_qml.xml
index 30d21d86f..c292389e9 100644
--- a/sources/pyside6/PySide6/QtQml/typesystem_qml.xml
+++ b/sources/pyside6/PySide6/QtQml/typesystem_qml.xml
@@ -56,12 +56,9 @@
</inject-code>
<inject-code class="native" position="beginning">
- #include "pysideqmlregistertype.h"
- #include "pysideqmllistproperty.h"
- #include "pysideqmluncreatable.h"
+ #include &lt;pysideqml.h&gt;
+ #include &lt;pysideqmlregistertype.h&gt;
#include "pysideqmlvolatilebool.h"
- #include "pysideqmlmetacallerror_p.h"
- #include &lt;signalmanager.h&gt;
</inject-code>
<!-- This is to inform the generator that the VolatileBool python type exists -->
diff --git a/sources/pyside6/PySide6/glue/qtqml.cpp b/sources/pyside6/PySide6/glue/qtqml.cpp
index d32265d2e..12b394133 100644
--- a/sources/pyside6/PySide6/glue/qtqml.cpp
+++ b/sources/pyside6/PySide6/glue/qtqml.cpp
@@ -73,10 +73,8 @@ int %0 = PySide::qmlRegisterType(%ARGUMENT_NAMES, false);
// @snippet qmlregisteruncreatabletype
// @snippet init
-initQtQmlListProperty(module);
-initQmlUncreatable(module);
+PySide::Qml::init(module);
initQtQmlVolatileBool(module);
-PySide::SignalManager::setQmlMetaCallErrorHandler(PySide::qmlMetaCallErrorHandler);
// @snippet init
// @snippet qjsengine-toscriptvalue
diff --git a/sources/pyside6/cmake/Macros/PySideModules.cmake b/sources/pyside6/cmake/Macros/PySideModules.cmake
index 462c47441..b43800035 100644
--- a/sources/pyside6/cmake/Macros/PySideModules.cmake
+++ b/sources/pyside6/cmake/Macros/PySideModules.cmake
@@ -174,7 +174,7 @@ macro(create_pyside_module)
else()
set(ld_prefix_var_name "LD_LIBRARY_PATH")
endif()
- set(ld_prefix "${ld_prefix_var_name}=${pysidebindings_BINARY_DIR}/libpyside${PATH_SEP}${SHIBOKEN_SHARED_LIBRARY_DIR}")
+ set(ld_prefix "${ld_prefix_var_name}=${pysidebindings_BINARY_DIR}/libpyside${PATH_SEP}${pysidebindings_BINARY_DIR}/libpysideqml${PATH_SEP}${SHIBOKEN_SHARED_LIBRARY_DIR}")
# Append any existing ld_prefix values, so existing PATH, LD_LIBRARY_PATH, etc.
# On Windows it is needed because pyside modules import Qt,
diff --git a/sources/pyside6/cmake/PySideSetup.cmake b/sources/pyside6/cmake/PySideSetup.cmake
index e4b098ad6..c04822999 100644
--- a/sources/pyside6/cmake/PySideSetup.cmake
+++ b/sources/pyside6/cmake/PySideSetup.cmake
@@ -156,6 +156,8 @@ foreach(m ${DISABLED_MODULES})
set(DISABLE_Qt${m} 1)
endforeach()
+# Whether to add libpysideqml
+find_package(Qt${QT_MAJOR_VERSION}Qml)
string(REGEX MATCHALL "[0-9]+" qt_version_helper "${Qt${QT_MAJOR_VERSION}Core_VERSION}")
diff --git a/sources/pyside6/libpysideqml/CMakeLists.txt b/sources/pyside6/libpysideqml/CMakeLists.txt
new file mode 100644
index 000000000..8142f7040
--- /dev/null
+++ b/sources/pyside6/libpysideqml/CMakeLists.txt
@@ -0,0 +1,85 @@
+set(libpysideqml_libraries Qt::Core Qt::CorePrivate Qt::Qml Qt::QmlPrivate)
+
+set(libpysideqml_SRC
+ pysideqml.cpp
+ pysideqmlregistertype.cpp
+ pysideqmlmetacallerror.cpp
+ pysideqmllistproperty.cpp
+ pysideqmluncreatable.cpp
+)
+
+add_library(pyside6qml SHARED ${libpysideqml_SRC} ${other_files})
+add_library(PySide6::pyside6qml ALIAS pyside6qml)
+
+target_include_directories(pyside6qml PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<INSTALL_INTERFACE:include/PySide6Qml>
+)
+
+target_link_libraries(pyside6qml
+ PRIVATE PySide6::pyside6 Shiboken6::libshiboken ${libpysideqml_libraries})
+
+set_target_properties(pyside6qml PROPERTIES
+ VERSION ${BINDING_API_VERSION}
+ SOVERSION "${PYSIDE_SO_VERSION}"
+ OUTPUT_NAME "pyside6qml${pyside6_SUFFIX}${SHIBOKEN_PYTHON_SHARED_LIBRARY_SUFFIX}"
+ DEFINE_SYMBOL BUILD_LIBPYSIDEQML)
+
+set_property(TARGET pyside6 PROPERTY CXX_STANDARD 17)
+
+if(PYSIDE_QT_CONF_PREFIX)
+ set_property(SOURCE pysideqml.cpp
+ APPEND
+ PROPERTY COMPILE_DEFINITIONS
+ PYSIDE_QT_CONF_PREFIX=${PYSIDE_QT_CONF_PREFIX})
+endif()
+
+#
+# install stuff
+#
+
+set(libpysideqml_HEADERS
+ pysideqmlmacros.h
+ pysideqml.h
+ pysideqmlregistertype.h
+)
+
+if (CMAKE_BUILD_TYPE STREQUAL "Debug")
+ set(LIBRARY_OUTPUT_SUFFIX ${CMAKE_DEBUG_POSTFIX})
+else()
+ set(LIBRARY_OUTPUT_SUFFIX ${CMAKE_RELEASE_POSTFIX})
+endif()
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D QT_NO_CAST_FROM_ASCII -D QT_NO_CAST_TO_ASCII")
+
+# Install-tree / relocatable package config file.
+configure_package_config_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/PySide6QmlConfig-spec.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/install/PySide6QmlConfig${SHIBOKEN_PYTHON_CONFIG_SUFFIX}.cmake"
+ INSTALL_DESTINATION "${LIB_INSTALL_DIR}/cmake/PySide6Qml-${BINDING_API_VERSION}"
+)
+
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/PySide6QmlConfig.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/PySide6QmlConfig.cmake" @ONLY)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/PySide6QmlConfigVersion.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/PySide6QmlConfigVersion.cmake" @ONLY)
+
+install(FILES ${libpysideqml_HEADERS}
+ DESTINATION include/${BINDING_NAME}${pyside6qml_SUFFIX})
+
+install(TARGETS pyside6qml EXPORT PySide6QmlTargets
+ LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
+ ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
+ RUNTIME DESTINATION bin)
+install(EXPORT PySide6QmlTargets NAMESPACE PySide6Qml::
+ DESTINATION "${LIB_INSTALL_DIR}/cmake/PySide6Qml-${BINDING_API_VERSION}")
+
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PySide6QmlConfig.cmake"
+ DESTINATION "${LIB_INSTALL_DIR}/cmake/PySide6Qml-${BINDING_API_VERSION}")
+
+install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/install/PySide6QmlConfig${SHIBOKEN_PYTHON_CONFIG_SUFFIX}.cmake"
+ DESTINATION "${LIB_INSTALL_DIR}/cmake/PySide6Qml-${BINDING_API_VERSION}")
+
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PySide6QmlConfigVersion.cmake"
+ DESTINATION "${LIB_INSTALL_DIR}/cmake/PySide6Qml-${BINDING_API_VERSION}")
diff --git a/sources/pyside6/libpysideqml/PySide6QmlConfig-spec.cmake.in b/sources/pyside6/libpysideqml/PySide6QmlConfig-spec.cmake.in
new file mode 100644
index 000000000..36eb4123a
--- /dev/null
+++ b/sources/pyside6/libpysideqml/PySide6QmlConfig-spec.cmake.in
@@ -0,0 +1,7 @@
+@PACKAGE_INIT@
+
+# Import targets only when using an installed PySide6 config file (so not during a regular
+# PySide6 build, or during a super project build).
+if (NOT TARGET PySide6::pyside6qml)
+ include("${CMAKE_CURRENT_LIST_DIR}/PySide6QmlTargets.cmake")
+endif()
diff --git a/sources/pyside6/libpysideqml/PySide6QmlConfig.cmake.in b/sources/pyside6/libpysideqml/PySide6QmlConfig.cmake.in
new file mode 100644
index 000000000..dab0a6b13
--- /dev/null
+++ b/sources/pyside6/libpysideqml/PySide6QmlConfig.cmake.in
@@ -0,0 +1,5 @@
+if (NOT PYTHON_CONFIG_SUFFIX)
+ message(STATUS "PySide6QmlConfig: Using default python: @SHIBOKEN_PYTHON_CONFIG_SUFFIX@")
+ SET(PYTHON_CONFIG_SUFFIX @SHIBOKEN_PYTHON_CONFIG_SUFFIX@)
+endif()
+include(${CMAKE_CURRENT_LIST_DIR}/PySide6QmlConfig${PYTHON_CONFIG_SUFFIX}.cmake)
diff --git a/sources/pyside6/libpysideqml/PySide6QmlConfigVersion.cmake.in b/sources/pyside6/libpysideqml/PySide6QmlConfigVersion.cmake.in
new file mode 100644
index 000000000..f5073ce08
--- /dev/null
+++ b/sources/pyside6/libpysideqml/PySide6QmlConfigVersion.cmake.in
@@ -0,0 +1,10 @@
+set(PACKAGE_VERSION @BINDING_API_VERSION@)
+
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
+ if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+ set(PACKAGE_VERSION_EXACT TRUE)
+ endif( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+endif("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
diff --git a/sources/pyside6/libpysideqml/pysideqml.cpp b/sources/pyside6/libpysideqml/pysideqml.cpp
new file mode 100644
index 000000000..6bdc277f6
--- /dev/null
+++ b/sources/pyside6/libpysideqml/pysideqml.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 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$
+**
+****************************************************************************/
+
+#include "pysideqml.h"
+#include "pysideqmllistproperty_p.h"
+#include "pysideqmluncreatable.h"
+#include "pysideqmluncreatable.h"
+#include "pysideqmlmetacallerror_p.h"
+
+#include <signalmanager.h>
+
+namespace PySide::Qml
+{
+
+void init(PyObject *module)
+{
+ initQtQmlListProperty(module);
+ initQmlUncreatable(module);
+ PySide::SignalManager::setQmlMetaCallErrorHandler(PySide::qmlMetaCallErrorHandler);
+}
+
+} //namespace PySide::Qml
diff --git a/sources/pyside6/libpysideqml/pysideqml.h b/sources/pyside6/libpysideqml/pysideqml.h
new file mode 100644
index 000000000..a227a4cee
--- /dev/null
+++ b/sources/pyside6/libpysideqml/pysideqml.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 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$
+**
+****************************************************************************/
+
+#ifndef PYSIDEQML_H
+#define PYSIDEQML_H
+
+#include "pysideqmlmacros.h"
+
+#include <sbkpython.h>
+
+namespace PySide::Qml
+{
+
+PYSIDEQML_API void init(PyObject *module);
+
+} //namespace PySide::Qml
+
+#endif // PYSIDEQML_H
diff --git a/sources/pyside6/PySide6/QtQml/pysideqmllistproperty.cpp b/sources/pyside6/libpysideqml/pysideqmllistproperty.cpp
index f817d26b5..7cca21326 100644
--- a/sources/pyside6/PySide6/QtQml/pysideqmllistproperty.cpp
+++ b/sources/pyside6/libpysideqml/pysideqmllistproperty.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "pysideqmllistproperty.h"
+#include "pysideqmllistproperty_p.h"
#include "pysideqmlregistertype_p.h"
#include <shiboken.h>
diff --git a/sources/pyside6/PySide6/QtQml/pysideqmllistproperty.h b/sources/pyside6/libpysideqml/pysideqmllistproperty_p.h
index bfae04bfc..bfae04bfc 100644
--- a/sources/pyside6/PySide6/QtQml/pysideqmllistproperty.h
+++ b/sources/pyside6/libpysideqml/pysideqmllistproperty_p.h
diff --git a/sources/pyside6/libpysideqml/pysideqmlmacros.h b/sources/pyside6/libpysideqml/pysideqmlmacros.h
new file mode 100644
index 000000000..208a92f04
--- /dev/null
+++ b/sources/pyside6/libpysideqml/pysideqmlmacros.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 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$
+**
+****************************************************************************/
+
+#ifndef PYSIDEQMLMACROS_H
+#define PYSIDEQMLMACROS_H
+
+#include <shibokenmacros.h>
+
+#define PYSIDEQML_EXPORT LIBSHIBOKEN_EXPORT
+#define PYSIDEQML_IMPORT LIBSHIBOKEN_IMPORT
+
+#ifdef BUILD_LIBPYSIDEQML
+# define PYSIDEQML_API PYSIDEQML_EXPORT
+#else
+# define PYSIDEQML_API PYSIDEQML_IMPORT
+#endif
+
+#endif // PYSIDEQMLMACROS_H
diff --git a/sources/pyside6/PySide6/QtQml/pysideqmlmetacallerror.cpp b/sources/pyside6/libpysideqml/pysideqmlmetacallerror.cpp
index ec3de6c24..4887e3f51 100644
--- a/sources/pyside6/PySide6/QtQml/pysideqmlmetacallerror.cpp
+++ b/sources/pyside6/libpysideqml/pysideqmlmetacallerror.cpp
@@ -89,6 +89,7 @@ std::optional<int> qmlMetaCallErrorHandler(QObject *object)
return engine->throwError(errString);
#else
Q_UNUSED(object);
+ qWarning("libpyside6qml was built without QML private API support, error handling will not work.");
return {};
#endif // QML_PRIVATE_API_SUPPORT
}
diff --git a/sources/pyside6/PySide6/QtQml/pysideqmlmetacallerror_p.h b/sources/pyside6/libpysideqml/pysideqmlmetacallerror_p.h
index 9ecb0f6eb..9ecb0f6eb 100644
--- a/sources/pyside6/PySide6/QtQml/pysideqmlmetacallerror_p.h
+++ b/sources/pyside6/libpysideqml/pysideqmlmetacallerror_p.h
diff --git a/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.cpp b/sources/pyside6/libpysideqml/pysideqmlregistertype.cpp
index 84fec16b6..84fec16b6 100644
--- a/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.cpp
+++ b/sources/pyside6/libpysideqml/pysideqmlregistertype.cpp
diff --git a/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.h b/sources/pyside6/libpysideqml/pysideqmlregistertype.h
index 643033237..b1c4f9dcc 100644
--- a/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.h
+++ b/sources/pyside6/libpysideqml/pysideqmlregistertype.h
@@ -40,13 +40,13 @@
#ifndef PYSIDEQMLREGISTERTYPE_H
#define PYSIDEQMLREGISTERTYPE_H
+#include "pysideqmlmacros.h"
+
#include <sbkpython.h>
namespace PySide
{
-extern void *nextQmlElementMemoryAddr;
-
/**
* PySide implementation of qmlRegisterType<T> function.
*
@@ -57,8 +57,10 @@ extern void *nextQmlElementMemoryAddr;
* \param qmlName QML element name
* \return the metatype id of the registered type.
*/
-int qmlRegisterType(PyObject *pyObj, const char *uri, int versionMajor, int versionMinor,
- const char *qmlName, const char *noCreationReason = nullptr, bool creatable = true);
+PYSIDEQML_API int qmlRegisterType(PyObject *pyObj, const char *uri,
+ int versionMajor, int versionMinor,
+ const char *qmlName, const char *noCreationReason = nullptr,
+ bool creatable = true);
/**
* PySide implementation of qmlRegisterSingletonType<T> function.
@@ -71,8 +73,9 @@ int qmlRegisterType(PyObject *pyObj, const char *uri, int versionMajor, int vers
* \param callback Registration callback
* \return the metatype id of the registered type.
*/
-int qmlRegisterSingletonType(PyObject *pyObj,const char *uri, int versionMajor, int versionMinor, const char *qmlName,
- PyObject *callback, bool isQObject, bool hasCallback);
+PYSIDEQML_API int qmlRegisterSingletonType(PyObject *pyObj,const char *uri,
+ int versionMajor, int versionMinor, const char *qmlName,
+ PyObject *callback, bool isQObject, bool hasCallback);
/**
* PySide implementation of qmlRegisterSingletonInstance<T> function.
@@ -85,24 +88,24 @@ int qmlRegisterSingletonType(PyObject *pyObj,const char *uri, int versionMajor,
* \param instanceObject singleton object to be registered.
* \return the metatype id of the registered type.
*/
-int qmlRegisterSingletonInstance(PyObject *pyObj, const char *uri, int versionMajor,
- int versionMinor, const char *qmlName, PyObject *instanceObject);
-
+PYSIDEQML_API int qmlRegisterSingletonInstance(PyObject *pyObj, const char *uri,
+ int versionMajor, int versionMinor,
+ const char *qmlName, PyObject *instanceObject);
/**
* PySide implementation of the QML_ELEMENT macro
*
* \param pyObj Python type to be registered
*/
-PyObject *qmlElementMacro(PyObject *pyObj);
+PYSIDEQML_API PyObject *qmlElementMacro(PyObject *pyObj);
/// PySide implementation of the QML_ANONYMOUS macro
/// \param pyObj Python type to be registered
-PyObject *qmlAnonymousMacro(PyObject *pyObj);
+PYSIDEQML_API PyObject *qmlAnonymousMacro(PyObject *pyObj);
/// PySide implementation of the QML_SINGLETON macro
/// \param pyObj Python type to be registered
-PyObject *qmlSingletonMacro(PyObject *pyObj);
+PYSIDEQML_API PyObject *qmlSingletonMacro(PyObject *pyObj);
} // namespace PySide
diff --git a/sources/pyside6/PySide6/QtQml/pysideqmlregistertype_p.h b/sources/pyside6/libpysideqml/pysideqmlregistertype_p.h
index d357a0392..d357a0392 100644
--- a/sources/pyside6/PySide6/QtQml/pysideqmlregistertype_p.h
+++ b/sources/pyside6/libpysideqml/pysideqmlregistertype_p.h
diff --git a/sources/pyside6/PySide6/QtQml/pysideqmluncreatable.cpp b/sources/pyside6/libpysideqml/pysideqmluncreatable.cpp
index e59476146..e59476146 100644
--- a/sources/pyside6/PySide6/QtQml/pysideqmluncreatable.cpp
+++ b/sources/pyside6/libpysideqml/pysideqmluncreatable.cpp
diff --git a/sources/pyside6/PySide6/QtQml/pysideqmluncreatable.h b/sources/pyside6/libpysideqml/pysideqmluncreatable.h
index 89a5f1223..89a5f1223 100644
--- a/sources/pyside6/PySide6/QtQml/pysideqmluncreatable.h
+++ b/sources/pyside6/libpysideqml/pysideqmluncreatable.h
diff --git a/sources/pyside6/tests/init_paths.py b/sources/pyside6/tests/init_paths.py
index 64b4f8791..2e943d884 100644
--- a/sources/pyside6/tests/init_paths.py
+++ b/sources/pyside6/tests/init_paths.py
@@ -75,7 +75,8 @@ def _init_test_paths(shiboken_tests=False, testbindings_module=False):
pyside_build_dir = os.path.join(get_build_dir(), 'pyside6')
python_dirs.append(pyside_build_dir) # for PySide6
- lib_dirs = [os.path.join(pyside_build_dir, 'libpyside')]
+ lib_dirs = [os.path.join(pyside_build_dir, 'libpyside'),
+ os.path.join(pyside_build_dir, 'libpysideqml')]
if testbindings_module:
python_dirs.append(os.path.join(pyside_build_dir,