diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-04 08:15:17 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-04 08:29:54 +0000 |
commit | 9768da0be5a09632c60c4e4035fa52b9c55376df (patch) | |
tree | d9e0d8545e08597f208cda183787b51028fa0680 /sources | |
parent | f47818b5c710aa6ae5f76809046105cb8c3d9f7f (diff) |
Remove QtScript, QtXmlPatterns
They are obsolete in Qt 6.
Task-number: PYSIDE-1339
Task-number: PYSIDE-904
Change-Id: I70816b3c3270a1db65ad3b3871a09c62d31420e5
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources')
23 files changed, 1 insertions, 995 deletions
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index 678983a50..d7eaf84d6 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -514,15 +514,11 @@ <rejection class="" enum-name="enum_1"/> <rejection class="" enum-name="enum_2"/> <rejection class="" enum-name="QtValidLicenseForXmlModule"/> - <rejection class="" enum-name="QtValidLicenseForXmlPatternsModule"/> <rejection class="" enum-name="QtValidLicenseForActiveQtModule"/> <rejection class="" enum-name="QtValidLicenseForCoreModule"/> - <rejection class="" enum-name="QtValidLicenseForQt3SupportLightModule"/> - <rejection class="" enum-name="QtValidLicenseForQt3SupportModule"/> <rejection class="" enum-name="QtValidLicenseForNetworkModule"/> <rejection class="" enum-name="QtValidLicenseForSvgModule"/> <rejection class="" enum-name="QtValidLicenseForGuiModule"/> - <rejection class="" enum-name="QtValidLicenseForScriptModule"/> <rejection class="" enum-name="QtValidLicenseForHelpModule"/> <!-- Internal --> <rejection class="QAbstractFileEngine"/> <!-- diff --git a/sources/pyside2/PySide2/QtScript/CMakeLists.txt b/sources/pyside2/PySide2/QtScript/CMakeLists.txt deleted file mode 100644 index 81d6c03d3..000000000 --- a/sources/pyside2/PySide2/QtScript/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -project(QtScript) - -set(QtScript_SRC -${QtScript_GEN_DIR}/qscriptable_wrapper.cpp -${QtScript_GEN_DIR}/qscriptclass_wrapper.cpp -${QtScript_GEN_DIR}/qscriptclasspropertyiterator_wrapper.cpp -${QtScript_GEN_DIR}/qscriptcontext_wrapper.cpp -${QtScript_GEN_DIR}/qscriptcontextinfo_wrapper.cpp -${QtScript_GEN_DIR}/qscriptengineagent_wrapper.cpp -${QtScript_GEN_DIR}/qscriptprogram_wrapper.cpp -${QtScript_GEN_DIR}/qscriptengine_wrapper.cpp -${QtScript_GEN_DIR}/qscriptextensioninterface_wrapper.cpp -${QtScript_GEN_DIR}/qscriptextensionplugin_wrapper.cpp -${QtScript_GEN_DIR}/qscriptstring_wrapper.cpp -${QtScript_GEN_DIR}/qscriptvalue_wrapper.cpp -${QtScript_GEN_DIR}/qscriptvalueiterator_wrapper.cpp -# module is always needed -${QtScript_GEN_DIR}/qtscript_module_wrapper.cpp -) - -set(QtScript_glue_sources - "${QtScript_SOURCE_DIR}/qscript_value_iterator_glue.cpp" -) - -set(QtScript_include_dirs ${QtScript_SOURCE_DIR} - ${QtScript_BINARY_DIR} - ${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS} - ${Qt${QT_MAJOR_VERSION}Script_INCLUDE_DIRS} - ${libpyside_SOURCE_DIR} - ${QtCore_GEN_DIR} - ) -set(QtScript_libraries pyside2 - ${Qt${QT_MAJOR_VERSION}Core_LIBRARIES} - ${Qt${QT_MAJOR_VERSION}Script_LIBRARIES}) -set(QtScript_deps QtCore) -create_pyside_module(NAME QtScript - INCLUDE_DIRS QtScript_include_dirs - LIBRARIES QtScript_libraries - DEPS QtScript_deps - TYPESYSTEM_PATH QtScript_SOURCE_DIR - SOURCES QtScript_SRC - GLUE_SOURCES QtScript_glue_sources) diff --git a/sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp b/sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp deleted file mode 100644 index 11dfd19b0..000000000 --- a/sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp +++ /dev/null @@ -1,3 +0,0 @@ -%PYARG_0 = Shiboken::Object::newObject( - reinterpret_cast<SbkObjectType *>(Shiboken::SbkType< ::QScriptValueIterator >()), - new QScriptValueIterator(*%CPPSELF), true, true); diff --git a/sources/pyside2/PySide2/QtScript/typesystem_script.xml b/sources/pyside2/PySide2/QtScript/typesystem_script.xml deleted file mode 100644 index 1fdad5d47..000000000 --- a/sources/pyside2/PySide2/QtScript/typesystem_script.xml +++ /dev/null @@ -1,105 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/**************************************************************************** -** -** Copyright (C) 2016 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.QtScript"> - <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/> - - <object-type name="QScriptable"/> - <object-type name="QScriptClass"> - <enum-type name="Extension"/> - <enum-type name="QueryFlag"/> - </object-type> - <object-type name="QScriptClassPropertyIterator"/> - <object-type name="QScriptContext"> - <enum-type name="Error"/> - <enum-type name="ExecutionState"/> - </object-type> - <value-type name="QScriptContextInfo"> - <enum-type name="FunctionType"/> - </value-type> - <object-type name="QScriptEngineAgent"> - <enum-type name="Extension"/> - </object-type> - <object-type name="QScriptEngine"> - <enum-type name="QObjectWrapOption" flags="QObjectWrapOptions"/> - <enum-type name="ValueOwnership"/> - <!-- Not supported BUG #957--> - <modify-function signature="scriptValueFromQMetaObject()" remove="all"/> - </object-type> - <object-type name="QScriptExtensionInterface"/> - <object-type name="QScriptExtensionPlugin"/> - <value-type name="QScriptProgram" since="4.7"/> - <value-type name="QScriptString"> - <modify-function signature="toArrayIndex(bool*)const"> - <modify-argument index="1"> - <remove-argument/> - </modify-argument> - <inject-code class="target" position="beginning"> - <insert-template name="fix_bool*"/> - </inject-code> - </modify-function> - </value-type> - <value-type name="QScriptValue"> - <enum-type name="PropertyFlag" flags="PropertyFlags"/> - <enum-type name="ResolveFlag" flags="ResolveFlags"/> - <enum-type name="SpecialValue"/> - <add-function signature="__repr__" return-type="PyObject*"> - <inject-code class="target" position="beginning" file="../glue/qtscript.cpp" snippet="qscriptvalue-repr"/> - </add-function> - <add-function signature="__mgetitem__"> - <inject-code file="../glue/qtscript.cpp" snippet="qscriptvalue-mgetitem"/> - </add-function> - <add-function signature="__iter__()" return-type="PyObject*"> - <inject-code file="qscript_value_iterator_glue.cpp"/> - </add-function> - </value-type> - <object-type name="QScriptValueIterator"> - <add-function signature="__iter__()" return-type="PyObject*"> - <inject-code> - <insert-template name="__iter__"/> - </inject-code> - </add-function> - <add-function signature="__next__()" return-type="PyObject*"> - <inject-code file="../glue/qtscript.cpp" snippet="qscriptvalueiterator-next"/> - </add-function> - </object-type> -</typesystem> - diff --git a/sources/pyside2/PySide2/QtScriptTools/CMakeLists.txt b/sources/pyside2/PySide2/QtScriptTools/CMakeLists.txt deleted file mode 100644 index 7c19856cb..000000000 --- a/sources/pyside2/PySide2/QtScriptTools/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -project(QtScriptTools) - -set(QtScriptTools_SRC -${QtScriptTools_GEN_DIR}/qscriptenginedebugger_wrapper.cpp -# module is always needed -${QtScriptTools_GEN_DIR}/qtscripttools_module_wrapper.cpp -) - -set(QtScriptTools_include_dirs ${QtScriptTools_SOURCE_DIR} - ${QtScriptTools_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}Script_INCLUDE_DIRS} - ${Qt${QT_MAJOR_VERSION}ScriptTools_INCLUDE_DIRS} - ${libpyside_SOURCE_DIR} - ${QtCore_GEN_DIR} - ${QtGui_GEN_DIR} - ${QtWidgets_GEN_DIR} - ${QtScript_GEN_DIR} - ) - -set(QtScriptTools_libraries pyside2 - ${Qt${QT_MAJOR_VERSION}Core_LIBRARIES} - ${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES} - ${Qt${QT_MAJOR_VERSION}Widgets_LIBRARIES} - ${Qt${QT_MAJOR_VERSION}Script_LIBRARIES} - ${Qt${QT_MAJOR_VERSION}ScriptTools_LIBRARIES}) - -set(QtScriptTools_deps QtCore QtScript QtGui QtWidgets) - -create_pyside_module(NAME QtScriptTools - INCLUDE_DIRS QtScriptTools_include_dirs - LIBRARIES QtScriptTools_libraries - DEPS QtScriptTools_deps - TYPESYSTEM_PATH QtScriptTools_SOURCE_DIR - SOURCES QtScriptTools_SRC) diff --git a/sources/pyside2/PySide2/QtScriptTools/typesystem_scripttools.xml b/sources/pyside2/PySide2/QtScriptTools/typesystem_scripttools.xml deleted file mode 100644 index eefa09a54..000000000 --- a/sources/pyside2/PySide2/QtScriptTools/typesystem_scripttools.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/**************************************************************************** -** -** Copyright (C) 2016 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.QtScriptTools"> - <load-typesystem name="QtScript/typesystem_script.xml" generate="no"/> - <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/> - <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/> - - <object-type name="QScriptEngineDebugger"> - <enum-type name="DebuggerAction"/> - <enum-type name="DebuggerState" since="4.6"/> - <enum-type name="DebuggerWidget"/> - <extra-includes> - <include file-name="QScriptEngine" location="global"/> - </extra-includes> - </object-type> -</typesystem> diff --git a/sources/pyside2/PySide2/QtXmlPatterns/CMakeLists.txt b/sources/pyside2/PySide2/QtXmlPatterns/CMakeLists.txt deleted file mode 100644 index adc1be516..000000000 --- a/sources/pyside2/PySide2/QtXmlPatterns/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -project(QtXmlPatterns) - -set(QtXmlPatterns_SRC -${QtXmlPatterns_GEN_DIR}/qabstractmessagehandler_wrapper.cpp -${QtXmlPatterns_GEN_DIR}/qabstracturiresolver_wrapper.cpp -${QtXmlPatterns_GEN_DIR}/qabstractxmlnodemodel_wrapper.cpp -${QtXmlPatterns_GEN_DIR}/qabstractxmlreceiver_wrapper.cpp -${QtXmlPatterns_GEN_DIR}/qsourcelocation_wrapper.cpp -${QtXmlPatterns_GEN_DIR}/qxmlformatter_wrapper.cpp -${QtXmlPatterns_GEN_DIR}/qxmlitem_wrapper.cpp -${QtXmlPatterns_GEN_DIR}/qxmlnamepool_wrapper.cpp -${QtXmlPatterns_GEN_DIR}/qxmlname_wrapper.cpp -${QtXmlPatterns_GEN_DIR}/qxmlnodemodelindex_wrapper.cpp -${QtXmlPatterns_GEN_DIR}/qxmlquery_wrapper.cpp -${QtXmlPatterns_GEN_DIR}/qxmlresultitems_wrapper.cpp -${QtXmlPatterns_GEN_DIR}/qxmlschemavalidator_wrapper.cpp -${QtXmlPatterns_GEN_DIR}/qxmlschema_wrapper.cpp -${QtXmlPatterns_GEN_DIR}/qxmlserializer_wrapper.cpp -## always needed -${QtXmlPatterns_GEN_DIR}/qtxmlpatterns_module_wrapper.cpp -) - -set(QtXmlPatterns_include_dirs ${QtXmlPatterns_SOURCE_DIR} - ${QtXmlPatterns_BINARY_DIR} - ${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS} - ${Qt${QT_MAJOR_VERSION}XmlPatterns_INCLUDE_DIRS} - ${libpyside_SOURCE_DIR} - ${QtCore_GEN_DIR} - ) -set(QtXmlPatterns_libraries pyside2 - ${Qt${QT_MAJOR_VERSION}Core_LIBRARIES} - ${Qt${QT_MAJOR_VERSION}XmlPatterns_LIBRARIES}) -set(QtXmlPatterns_deps QtCore) - -create_pyside_module(NAME QtXmlPatterns - INCLUDE_DIRS QtXmlPatterns_include_dirs - LIBRARIES QtXmlPatterns_libraries - DEPS QtXmlPatterns_deps - TYPESYSTEM_PATH QtXmlPatterns_SOURCE_DIR - SOURCES QtXmlPatterns_SRC) - diff --git a/sources/pyside2/PySide2/QtXmlPatterns/typesystem_xmlpatterns.xml b/sources/pyside2/PySide2/QtXmlPatterns/typesystem_xmlpatterns.xml deleted file mode 100644 index 1e8eec083..000000000 --- a/sources/pyside2/PySide2/QtXmlPatterns/typesystem_xmlpatterns.xml +++ /dev/null @@ -1,122 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/**************************************************************************** -** -** Copyright (C) 2016 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.QtXmlPatterns"> - <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/> - - <object-type name="QXmlSchema" since="4.6"/> <!-- Qt scoped pointer does not allow declare this as value type --> - <object-type name="QXmlSchemaValidator" since="4.6"> - <modify-function signature="schema()const"> - <modify-argument index="return"> - <replace-type modified-type="QXmlSchema*"/> - <define-ownership owner="target"/> - </modify-argument> - <inject-code file="../glue/qtxmlpatterns.cpp" snippet="qxmlschemavalidator-schema"/> - </modify-function> - </object-type> - <object-type name="QAbstractMessageHandler"/> - <object-type name="QAbstractUriResolver"/> - <object-type name="QAbstractXmlNodeModel"> - <enum-type name="NodeCopySetting"/> - <enum-type name="SimpleAxis"/> - </object-type> - <object-type name="QAbstractXmlReceiver"/> - <value-type name="QSourceLocation"/> - <object-type name="QXmlFormatter"/> - <value-type name="QXmlItem"/> - <value-type name="QXmlName"> - <primitive-type name="NamespaceCode"/> - <primitive-type name="PrefixCode"/> - <primitive-type name="LocalNameCode"/> - <!-- ### These methods aren't part of Qt public API --> - <modify-function signature="QXmlName(QXmlName::NamespaceCode,QXmlName::LocalNameCode,QXmlName::PrefixCode)" remove="all"/> - <modify-function signature="setNamespaceURI(QXmlName::NamespaceCode)" remove="all"/> - <modify-function signature="localName()const" remove="all"/> - <modify-function signature="prefix()const" remove="all"/> - <modify-function signature="hasPrefix()const" remove="all"/> - <modify-function signature="hasNamespace()const" remove="all"/> - <modify-function signature="namespaceURI()const" remove="all"/> - <modify-function signature="isLexicallyEqual(const QXmlName&)const" remove="all"/> - <modify-function signature="setPrefix(QXmlName::PrefixCode)" remove="all"/> - <modify-function signature="setLocalName(QXmlName::LocalNameCode)" remove="all"/> - <modify-function signature="code()const" remove="all"/> - <!-- ### --> - </value-type> - <value-type name="QXmlNamePool"/> - - <rejection class="QXmlNodeModelIndex" function-name="type"/> - <rejection class="QXmlNodeModelIndex" function-name="sequencedTypedValue"/> - <rejection class="QXmlNodeModelIndex" function-name="iterate"/> - <!-- ### This enum isn't part of Qt public API --> - <suppress-warning text="Enum 'QXmlNodeModelIndex::Axis' (class: QXmlNodeModelIndex) does not have a type entry"/> - <value-type name="QXmlNodeModelIndex"> - <enum-type name="DocumentOrder"/> - <enum-type name="NodeKind"/> - <!-- ### Qt internal methods --> - <modify-function signature="name()const" remove="all"/> - <modify-function signature="root()const" remove="all"/> - <modify-function signature="documentUri()const" remove="all"/> - <modify-function signature="baseUri()const" remove="all"/> - <modify-function signature="kind()const" remove="all"/> - <modify-function signature="isDeepEqual(const QXmlNodeModelIndex&)const" remove="all"/> - <modify-function signature="compareOrder(const QXmlNodeModelIndex &)const" remove="all"/> - <modify-function signature="sendNamespaces(QAbstractXmlReceiver*const)const" remove="all"/> - <modify-function signature="namespaceBindings()const" remove="all"/> - <modify-function signature="namespaceForPrefix(QXmlName::PrefixCode)const" remove="all"/> - <modify-function signature="stringValue()const" remove="all"/> - <modify-function signature="is(const QXmlNodeModelIndex &)const" remove="all"/> - <modify-function signature="reset()" remove="all"/> - <!-- ### --> - </value-type> - - <value-type name="QXmlQuery"> - <!-- ### TODO: must evaluate if anything other than removal is needed. --> - <enum-type name="QueryLanguage"/> - <modify-function signature="evaluateTo(QStringList*)const" remove="all"/> - <modify-function signature="evaluateTo(QString*)const" remove="all"/> - <!-- ### --> - </value-type> - <object-type name="QXmlResultItems"/> - <object-type name="QXmlSerializer"/> - - <suppress-warning text="class 'QAbstractXmlNodeModel' inherits from unknown base class 'QSharedData'"/> - <suppress-warning text="class not found for setup inheritance 'QSharedData'"/> -</typesystem> diff --git a/sources/pyside2/doc/modules.rst b/sources/pyside2/doc/modules.rst index bb4b112a1..f42fac636 100644 --- a/sources/pyside2/doc/modules.rst +++ b/sources/pyside2/doc/modules.rst @@ -78,10 +78,6 @@ Qt Modules Provides information about the X display configuration. - :mod:`Qt Xml <PySide2.QtXml>` Provides C++ implementations of SAX and DOM. - * - :mod:`Qt XmlPatterns <PySide2.QtXmlPatterns>` - Provides support for XPath, XQuery, XSLTi, and XML Schema validation. - - :mod:`Qt 3D Core <PySide2.Qt3DCore>` - Contains functionality to support near-realtime simulation systems. * - :mod:`Qt 3D Extras <PySide2.Qt3DExtras>` Provides a set of prebuilt elements to help you get started with Qt 3D. - :mod:`Qt 3D Input <PySide2.Qt3DInput>` diff --git a/sources/pyside2/doc/qtmodules/pyside-qtxmlpatterns.qdocconf.in b/sources/pyside2/doc/qtmodules/pyside-qtxmlpatterns.qdocconf.in deleted file mode 100644 index 9e132ff24..000000000 --- a/sources/pyside2/doc/qtmodules/pyside-qtxmlpatterns.qdocconf.in +++ /dev/null @@ -1,2 +0,0 @@ -include(@QT_SRC_DIR@/../qtxmlpatterns/src/xmlpatterns/doc/qtxmlpatterns.qdocconf) -include(../pyside-config.qdocconf) diff --git a/sources/pyside2/tests/QtScript/CMakeLists.txt b/sources/pyside2/tests/QtScript/CMakeLists.txt deleted file mode 100644 index dfea68df0..000000000 --- a/sources/pyside2/tests/QtScript/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -PYSIDE_TEST(base_test.py) -PYSIDE_TEST(bug_1022.py) -PYSIDE_TEST(engine_test.py) -PYSIDE_TEST(property_test.py) -PYSIDE_TEST(qscriptvalue_test.py) diff --git a/sources/pyside2/tests/QtScript/base_test.py b/sources/pyside2/tests/QtScript/base_test.py deleted file mode 100644 index 3cde8ad83..000000000 --- a/sources/pyside2/tests/QtScript/base_test.py +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $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 os -import sys - -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 import QtScript - - -#only test if the module import works fine bug #278 diff --git a/sources/pyside2/tests/QtScript/bug_1022.py b/sources/pyside2/tests/QtScript/bug_1022.py deleted file mode 100644 index 2c2699de6..000000000 --- a/sources/pyside2/tests/QtScript/bug_1022.py +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $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 os -import sys -import unittest - -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.QtScript import * - -class QScriptValueTest(unittest.TestCase): - def testQScriptValue(self): - app = QCoreApplication([]) - engine = QScriptEngine() - repr(engine.evaluate('1 + 1')) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtScript/engine_test.py b/sources/pyside2/tests/QtScript/engine_test.py deleted file mode 100644 index f88b98d69..000000000 --- a/sources/pyside2/tests/QtScript/engine_test.py +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $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 os -import sys -import unittest - -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 QObject -from PySide2.QtScript import QScriptEngine - -class QScriptEngineTest(unittest.TestCase): - - def testQScriptEngine(self): - engine = QScriptEngine() - obj = engine.evaluate("({ unitName: 'Celsius', toKelvin: function(x) { return x + 273; } })") - toKelvin = obj.property("toKelvin") - result = toKelvin.call(obj, [100]) - self.assertEqual(result.toNumber(), 373) diff --git a/sources/pyside2/tests/QtScript/property_test.py b/sources/pyside2/tests/QtScript/property_test.py deleted file mode 100644 index 372bba2ba..000000000 --- a/sources/pyside2/tests/QtScript/property_test.py +++ /dev/null @@ -1,96 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $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 os -import sys -import unittest - -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 QObject, Property, QCoreApplication -from PySide2.QtScript import QScriptEngine - -class MyObject(QObject): - def __init__(self, parent = None): - QObject.__init__(self, parent) - self._p = 100 - - def setX(self, value): - self._p = value - - def getX(self): - return self._p - - def resetX(self): - self._p = 100 - - def delX(self): - self._p = 0 - - x = Property(int, getX, setX, resetX, delX) - - -class QPropertyTest(unittest.TestCase): - - def testSimple(self): - o = MyObject() - self.assertEqual(o.x, 100) - o.x = 42 - self.assertEqual(o.x, 42) - - def testHasProperty(self): - o = MyObject() - o.setProperty("x", 10) - self.assertEqual(o.x, 10) - self.assertEqual(o.property("x"), 10) - - def testMetaProperty(self): - o = MyObject() - m = o.metaObject() - found = False - for i in range(m.propertyCount()): - mp = m.property(i) - if mp.name() == "x": - found = True - break - self.assertTrue(found) - - def testScriptQProperty(self): - qapp = QCoreApplication([]) - myEngine = QScriptEngine() - obj = MyObject() - scriptObj = myEngine.newQObject(obj) - myEngine.globalObject().setProperty("obj", scriptObj) - myEngine.evaluate("obj.x = 42") - self.assertEqual(scriptObj.property("x").toInt32(), 42) - self.assertEqual(obj.property("x"), 42) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtScript/qscriptvalue_test.py b/sources/pyside2/tests/QtScript/qscriptvalue_test.py deleted file mode 100644 index 06a029232..000000000 --- a/sources/pyside2/tests/QtScript/qscriptvalue_test.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 the test suite of Qt for Python. -## -## $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 -import sys -import unittest - -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.QtScript import * - -# Required for eval() to work -import PySide2.QtScript - -from helper.usesqapplication import UsesQApplication - -class TestQScriptValue (UsesQApplication): - - def testOperator(self): - engine = QScriptEngine() - value = engine.evaluate('x = {"a": 1, "b":2}') - self.assertEqual(value['a'], 1) - self.assertRaises(KeyError, value.__getitem__, 'c') - value = engine.evaluate('x = ["x", "y", "z"]') - self.assertEqual(value[2], 'z') - self.assertRaises(IndexError, value.__getitem__, 23) - - def testRepr(self): - value = QScriptValue("somePerson = { firstName: 'John', lastName: 'Doe' }") - print(repr(value)) - value2 = eval(repr(value)) - self.assertEqual(value.toString(), value2.toString()) - self.assertEqual(value.toVariant(), value2.toVariant()) - - def testIteratorProtocol(self): - engine = QScriptEngine() - value = engine.evaluate('x = {"a": 1, "b":2}') - d = {} - for k, v in QScriptValueIterator(value): - d[k] = v - self.assertEqual(d, {'a': 1, 'b': 2}) - - d = {} - for k, v in value: - d[k] = v - self.assertEqual(d, {'a': 1, 'b': 2}) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtScriptTools/CMakeLists.txt b/sources/pyside2/tests/QtScriptTools/CMakeLists.txt deleted file mode 100644 index ee22737c6..000000000 --- a/sources/pyside2/tests/QtScriptTools/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -PYSIDE_TEST(debugger_test.py) diff --git a/sources/pyside2/tests/QtScriptTools/debugger_test.py b/sources/pyside2/tests/QtScriptTools/debugger_test.py deleted file mode 100644 index cefe48f5b..000000000 --- a/sources/pyside2/tests/QtScriptTools/debugger_test.py +++ /dev/null @@ -1,81 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $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 os -import sys -import unittest - -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 SIGNAL, QTimer -from PySide2.QtScript import QScriptEngine -from PySide2.QtScriptTools import QScriptEngineDebugger - -from helper.usesqapplication import UsesQApplication - -class DebuggerTest(UsesQApplication): - - def setUp(self): - UsesQApplication.setUp(self) - self.engine = QScriptEngine() - self.debugger = QScriptEngineDebugger() - self.has_suspended = 0 - self.has_resumed = 0 - self.count = 3 - - def suspended(self): - self.has_suspended += 1 - # Will emit evaluationResumed until there are more instructions to be run - QTimer.singleShot(100, self.debugger.action(QScriptEngineDebugger.StepIntoAction).trigger) - - def resumed(self): - # Will be called when debugger.state() change from Suspended to Running - # except for the first time. - self.has_resumed += 1 - - def testBasic(self): - '''Interrupt and resume evaluation with QScriptEngineDebugger''' - - self.debugger.attachTo(self.engine) - self.debugger.setAutoShowStandardWindow(False) - self.debugger.connect(SIGNAL('evaluationSuspended()'), self.suspended) - self.debugger.connect(SIGNAL('evaluationResumed()'), self.resumed) - - # For some reason StepIntoAction does not actually continue execution, and thus interrupting - # causes the test to hang. The same behavior is present in a Qt5.6 C++ code equivalent. It - # seems like a bug in QtScript, thus the interruption is commented out for now, which will - # force the test to fail. - #self.debugger.action(QScriptEngineDebugger.InterruptAction).trigger() - self.engine.evaluate("3+4\n2+1\n5+1") - self.assertTrue(self.has_resumed >= 1) - self.assertTrue(self.has_suspended >= 1) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtXmlPatterns/CMakeLists.txt b/sources/pyside2/tests/QtXmlPatterns/CMakeLists.txt deleted file mode 100644 index 7f570f156..000000000 --- a/sources/pyside2/tests/QtXmlPatterns/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -PYSIDE_TEST(import_test.py) diff --git a/sources/pyside2/tests/QtXmlPatterns/import_test.py b/sources/pyside2/tests/QtXmlPatterns/import_test.py deleted file mode 100644 index e60034e0d..000000000 --- a/sources/pyside2/tests/QtXmlPatterns/import_test.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/python - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $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 os -import sys -import unittest - -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.QtXmlPatterns import QXmlSchema -from helper.usesqcoreapplication import UsesQCoreApplication - - -class QXmlPatternsTest(UsesQCoreApplication): - - def testSchema(self): - data = QByteArray(py3k.b('''<?xml version=\"1.0\" encoding=\"UTF-8\"?> - <xsd:schema - xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" - xmlns=\"http://qt.nokia.com/xmlschematest\" - targetNamespace=\"http://qt.nokia.com/xmlschematest\" - version=\"1.0\" - elementFormDefault=\"qualified\"> - </xsd:schema>''')) - - buf = QBuffer(data) - buf.open(QIODevice.ReadOnly) - - schema = QXmlSchema() - schema.load(buf) - self.assertTrue(schema.isValid()) - - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/shiboken2/ApiExtractor/CMakeLists.txt b/sources/shiboken2/ApiExtractor/CMakeLists.txt index 1e135a46e..ec6f0ff18 100644 --- a/sources/shiboken2/ApiExtractor/CMakeLists.txt +++ b/sources/shiboken2/ApiExtractor/CMakeLists.txt @@ -31,7 +31,6 @@ parser/enumvalue.cpp xmlutils.cpp ) -find_package(Qt${QT_MAJOR_VERSION}XmlPatterns 5.12) find_package(Qt${QT_MAJOR_VERSION}Xml 5.12) find_package(LibXml2 2.6.32) find_package(LibXslt 1.1.19) @@ -41,7 +40,7 @@ if (LIBXSLT_FOUND AND LIBXML2_FOUND) set(HAS_LIBXSLT 1) endif() -if(NOT Qt${QT_MAJOR_VERSION}XmlPatterns_FOUND AND NOT HAS_LIBXSLT) +if(NOT HAS_LIBXSLT) set(DISABLE_DOCSTRINGS TRUE) message(WARNING "Documentation will not be built due to missing dependency (no Qt5XmlPatterns found).") @@ -67,20 +66,10 @@ if (HAS_LIBXSLT) PRIVATE ${LIBXSLT_LIBRARIES} ${LIBXML2_LIBRARIES}) endif() -if (Qt${QT_MAJOR_VERSION}XmlPatterns_FOUND) - target_compile_definitions(apiextractor PUBLIC HAVE_QTXMLPATTERNS) - target_sources(apiextractor PRIVATE xmlutils_qt.cpp) - target_link_libraries(apiextractor PUBLIC Qt${QT_MAJOR_VERSION}::Xml Qt${QT_MAJOR_VERSION}::XmlPatterns) -endif() - if (NOT DISABLE_DOCSTRINGS) target_sources(apiextractor PRIVATE docparser.cpp doxygenparser.cpp qtdocparser.cpp) - if (NOT HAS_LIBXSLT) - message(WARNING - "libxslt and/or libxml not found, falling back to QtXmlPatterns (QTBUG-66925)") - endif() endif() target_compile_definitions(apiextractor PRIVATE CMAKE_CXX_COMPILER="${CMAKE_CXX_COMPILER}") diff --git a/sources/shiboken2/ApiExtractor/xmlutils.cpp b/sources/shiboken2/ApiExtractor/xmlutils.cpp index a179412a7..6edca2fa5 100644 --- a/sources/shiboken2/ApiExtractor/xmlutils.cpp +++ b/sources/shiboken2/ApiExtractor/xmlutils.cpp @@ -28,7 +28,6 @@ #include "xmlutils.h" -#include "xmlutils_qt.h" #include "xmlutils_libxslt.h" XQuery::XQuery() = default; @@ -47,8 +46,6 @@ QSharedPointer<XQuery> XQuery::create(const QString &focus, QString *errorMessag { #if defined(HAVE_LIBXSLT) return libXml_createXQuery(focus, errorMessage); -#elif defined(HAVE_QTXMLPATTERNS) - return qt_createXQuery(focus, errorMessage); #else *errorMessage = QLatin1String(__FUNCTION__) + QLatin1String(" is not implemented."); return QSharedPointer<XQuery>(); @@ -59,8 +56,6 @@ QString xsl_transform(const QString &xml, const QString &xsl, QString *errorMess { #if defined(HAVE_LIBXSLT) return libXslt_transform(xml, xsl, errorMessage); -#elif defined(HAVE_QTXMLPATTERNS) - return qt_xsl_transform(xml, xsl, errorMessage); #else *errorMessage = QLatin1String(__FUNCTION__) + QLatin1String(" is not implemented."); return xml; diff --git a/sources/shiboken2/ApiExtractor/xmlutils_qt.cpp b/sources/shiboken2/ApiExtractor/xmlutils_qt.cpp deleted file mode 100644 index f703bc5f9..000000000 --- a/sources/shiboken2/ApiExtractor/xmlutils_qt.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Python. -** -** $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$ -** -****************************************************************************/ - -#include "xmlutils.h" -#include "xmlutils_qt.h" - -#include <QtXmlPatterns/QXmlQuery> - -#include <QtCore/QDir> -#include <QtCore/QUrl> - -class QtXQuery : public XQuery -{ -public: - QtXQuery() = default; - - bool setFocus(const QString &fileName) - { return m_xquery.setFocus(QUrl::fromLocalFile(fileName)); } - -protected: - QString doEvaluate(const QString &xPathExpression, QString *errorMessage) override; - -private: - QXmlQuery m_xquery; -}; - -QString QtXQuery::doEvaluate(const QString &xPathExpression, QString *errorMessage) -{ - m_xquery.setQuery(xPathExpression); - if (!m_xquery.isValid()) { - *errorMessage = QLatin1String("QXmlQuery: Bad query: \"") + xPathExpression - + QLatin1Char('"'); - return QString(); - } - - QString result; - m_xquery.evaluateTo(&result); - return result; -} - -QSharedPointer<XQuery> qt_createXQuery(const QString &focus, QString *errorMessage) -{ - QSharedPointer<QtXQuery> result(new QtXQuery); - if (!result->setFocus(focus)) { - *errorMessage = QLatin1String("QXmlQuery: Cannot set focus to ") + QDir::toNativeSeparators(focus); - result.reset(); - } - return std::move(result); -} - -// XSLT transformation - -static const char xsltPrefix[] = R"(<?xml version="1.0" encoding="UTF-8"?> - <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> -)"; - -QString qt_xsl_transform(const QString &xml, QString xsl, QString *errorMessage) -{ - QXmlQuery query(QXmlQuery::XSLT20); - if (!xsl.startsWith(QLatin1String("<?xml"))) { - xsl.prepend(QLatin1String(xsltPrefix)); - xsl.append(QLatin1String("</xsl:stylesheet>")); - } - query.setFocus(xml); - query.setQuery(xsl); - if (!query.isValid()) { - *errorMessage = QLatin1String("QXmlQuery: Invalid query \"") + xsl - + QLatin1String("\"."); - return xml; - } - QString result; - if (!query.evaluateTo(&result)) { - *errorMessage = QLatin1String("QXmlQuery: evaluate() failed."); - return xml; - } - return result.trimmed(); -} |