aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2021-04-16 11:09:29 +0200
committerMitch Curtis <mitch.curtis@qt.io>2021-04-21 14:37:10 +0200
commit93bd34b78fb33fbf8f2a2c3f97a512ba41de2575 (patch)
tree855451dbd757c28ffdf4663f47b4f45e11b2d8f9
parentab3cecbd2a9c9d8178bebc32955e8e94d30037d8 (diff)
Add QtCore module
[ChangeLog][QtQmlCore] Added QtCore QML module. Currently this only contains the StandardPaths singleton, but in the future could expose lots of useful types from Qt Core to QML. Fixes: QTBUG-92806 Change-Id: Ib99e2c5512ee04d6af1322f985fc9da965cf13a4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r--.gitignore1
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/core/CMakeLists.txt26
-rw-r--r--src/core/doc/qtqmlcore.qdocconf38
-rw-r--r--src/core/doc/src/qtqmlcore-qmltypes.qdoc55
-rw-r--r--src/core/doc/src/qtqmlcore.qdoc44
-rw-r--r--src/core/qqmlcoreglobal_p.h74
-rw-r--r--src/core/qqmlstandardpaths.cpp151
-rw-r--r--src/core/qqmlstandardpaths_p.h88
-rw-r--r--src/imports/CMakeLists.txt1
-rw-r--r--src/imports/core/CMakeLists.txt17
-rw-r--r--src/imports/core/plugin.cpp60
-rw-r--r--sync.profile1
-rw-r--r--tests/auto/CMakeLists.txt1
-rw-r--r--tests/auto/core/CMakeLists.txt16
-rw-r--r--tests/auto/core/data/tst_standardpaths.qml86
-rw-r--r--tests/auto/core/tst_core.cpp38
17 files changed, 698 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index b0423c27b6..87ac2687b1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,7 +30,6 @@ wrapper.bat
*_resource.rc
.#*
*.*#
-core
.qmake.cache
.qmake.stash
.qmake.vars
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f8c35a7eb5..d670bfdd37 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,6 +9,8 @@ add_subdirectory(qmltyperegistrar)
add_subdirectory(qml)
add_subdirectory(qmlmodels)
+add_subdirectory(core)
+
if(QT_FEATURE_qml_worker_script)
add_subdirectory(qmlworkerscript)
endif()
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
new file mode 100644
index 0000000000..500c73e8c5
--- /dev/null
+++ b/src/core/CMakeLists.txt
@@ -0,0 +1,26 @@
+ qt_internal_add_module(QmlCore
+ GENERATE_METATYPES
+ SOURCES
+ qqmlstandardpaths_p.h
+ qqmlstandardpaths.cpp
+ qqmlcoreglobal_p.h
+ DEFINES
+ QT_BUILD_QML_CORE_LIB
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::Qml
+)
+
+set_target_properties(QmlCore PROPERTIES
+ QT_QML_MODULE_INSTALL_QMLTYPES TRUE
+ QT_QML_MODULE_VERSION ${PROJECT_VERSION}
+ QT_QML_MODULE_URI QtCore
+ QT_QMLTYPES_FILENAME plugins.qmltypes
+ QT_QML_MODULE_INSTALL_DIR "${INSTALL_QMLDIR}/QtCore"
+)
+
+qt6_qml_type_registration(QmlCore)
+
+qt_internal_add_docs(QmlCore
+ doc/qtqmlcore.qdocconf
+)
diff --git a/src/core/doc/qtqmlcore.qdocconf b/src/core/doc/qtqmlcore.qdocconf
new file mode 100644
index 0000000000..12bad27c00
--- /dev/null
+++ b/src/core/doc/qtqmlcore.qdocconf
@@ -0,0 +1,38 @@
+include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+
+project = QtQmlCore
+description = Qt QML Core Reference Documentation
+version = $QT_VERSION
+
+qhp.projects = QtQmlCore
+
+qhp.QtQmlCore.file = qtqmlcore.qhp
+qhp.QtQmlCore.namespace = org.qt-project.qtqmlcore.$QT_VERSION_TAG
+qhp.QtQmlCore.virtualFolder = qtqmlcore
+qhp.QtQmlCore.indexTitle = Qt QML Core
+qhp.QtQmlCore.indexRoot =
+
+qhp.QtQmlCore.filterAttributes = qtqmlcore $QT_VERSION qtrefdoc
+qhp.QtQmlCore.customFilters.Qt.name = QtQmlCore $QT_VERSION
+qhp.QtQmlCore.customFilters.Qt.filterAttributes = qtqmlcore $QT_VERSION
+
+qhp.QtQmlCore.subprojects = qmltypes
+qhp.QtQmlCore.subprojects.qmltypes.title = QML Types
+qhp.QtQmlCore.subprojects.qmltypes.indexTitle = Qt QML Core QML Types
+qhp.QtQmlCore.subprojects.qmltypes.selectors = qmlclass
+qhp.QtQmlCore.subprojects.qmltypes.sortPages = true
+
+depends = qtcore qtdoc qtqml
+
+# This module has no documented C++ types, clear the module header
+moduleheader =
+
+headerdirs += ../
+sourcedirs += ../
+
+imagedirs += images
+
+navigation.landingpage = "Qt QML Core"
+navigation.qmltypespage = "Qt QML Core QML Types"
+
+tagfile = qtqmlcore.tags
diff --git a/src/core/doc/src/qtqmlcore-qmltypes.qdoc b/src/core/doc/src/qtqmlcore-qmltypes.qdoc
new file mode 100644
index 0000000000..8bd0a1712c
--- /dev/null
+++ b/src/core/doc/src/qtqmlcore-qmltypes.qdoc
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \qmlmodule QtCore 6.\QtMinorVersion
+ \title Qt QML Core QML Types
+ \ingroup qmlmodules
+ \brief Provides core system functionality in QML.
+
+ The Qt QML Core module provides core system functionality in QML.
+
+ The QML types can be imported into your application using the
+ following import statement in your .qml file:
+
+ \qml
+ import QtCore
+ \endqml
+
+ \section1 QML Types
+
+ \generatelist {qmltypesbymodule QtCore}
+
+ \section1 Related Information
+
+ \list
+ \li \l {Qt Core}
+ \li \l {Qt QML Types}
+ \endlist
+
+ \noautolist
+*/
diff --git a/src/core/doc/src/qtqmlcore.qdoc b/src/core/doc/src/qtqmlcore.qdoc
new file mode 100644
index 0000000000..c3e13cb189
--- /dev/null
+++ b/src/core/doc/src/qtqmlcore.qdoc
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtqmlcore-index.html
+ \title Qt QML Core
+
+ \brief The Qt QML Core module provides core system functionality in QML.
+
+ \section1 QML Types
+
+ \generatelist {qmltypesbymodule QtCore}
+
+ \section1 Related Information
+
+ \list
+ \li \l{Qt Core}
+ \li \l{Qt QML}
+ \endlist
+*/
diff --git a/src/core/qqmlcoreglobal_p.h b/src/core/qqmlcoreglobal_p.h
new file mode 100644
index 0000000000..85dc15b095
--- /dev/null
+++ b/src/core/qqmlcoreglobal_p.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQuick module of the Qt Toolkit.
+**
+** $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 QQMLCOREGLOBAL_P_H
+#define QQMLCOREGLOBAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+#if !defined(QT_STATIC)
+# if defined(QT_BUILD_QML_CORE_LIB)
+# define Q_QMLCORE_EXPORT Q_DECL_EXPORT
+# else
+# define Q_QMLCORE_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_QMLCORE_EXPORT
+#endif
+
+#define Q_QMLCORE_PRIVATE_EXPORT Q_QMLCORE_EXPORT
+
+QT_END_NAMESPACE
+
+void Q_QMLCORE_PRIVATE_EXPORT qml_register_types_QtCore();
+
+#endif // QQMLCOREGLOBAL_P_H
diff --git a/src/core/qqmlstandardpaths.cpp b/src/core/qqmlstandardpaths.cpp
new file mode 100644
index 0000000000..39c5eb3ebf
--- /dev/null
+++ b/src/core/qqmlstandardpaths.cpp
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $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 "qqmlstandardpaths_p.h"
+
+#include <QtQml/qqmlengine.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype StandardPaths
+ \inherits QtObject
+ \inqmlmodule QtCore
+ \since 6.2
+ \brief Provides access to the standard system paths.
+
+ The StandardPaths singleton type provides methods for querying the standard
+ system paths.
+
+ \qml
+ property url documentsFolder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
+ \endqml
+
+ \sa QStandardPaths
+*/
+
+static QList<QUrl> toUrlList(const QStringList &paths)
+{
+ QList<QUrl> urls;
+ urls.reserve(paths.size());
+ for (const QString &path : paths)
+ urls += QUrl::fromLocalFile(path);
+ return urls;
+}
+
+QQmlStandardPaths::QQmlStandardPaths(QObject *parent)
+ : QObject(parent)
+{
+}
+
+/*!
+ \qmlmethod string QtCore::StandardPaths::displayName(StandardLocation type)
+
+ \include standardpath/functiondocs.qdocinc displayName
+
+ \sa QStandardPaths::displayName()
+*/
+QString QQmlStandardPaths::displayName(QStandardPaths::StandardLocation type) const
+{
+ return QStandardPaths::displayName(type);
+}
+
+/*!
+ \qmlmethod url QtCore::StandardPaths::findExecutable(string executableName, list<string> paths) const
+
+ \include standardpath/functiondocs.qdocinc findExecutable
+
+ \sa QStandardPaths::findExecutable()
+*/
+QUrl QQmlStandardPaths::findExecutable(const QString &executableName, const QStringList &paths) const
+{
+ return QUrl::fromLocalFile(QStandardPaths::findExecutable(executableName, paths));
+}
+
+/*!
+ \qmlmethod url QtCore::StandardPaths::locate(StandardLocation type, string fileName, LocateOptions options) const
+
+ \include standardpath/functiondocs.qdocinc locate
+
+ \sa QStandardPaths::locate()
+*/
+QUrl QQmlStandardPaths::locate(QStandardPaths::StandardLocation type, const QString &fileName,
+ QStandardPaths::LocateOptions options) const
+{
+ return QUrl::fromLocalFile(QStandardPaths::locate(type, fileName, options));
+}
+
+/*!
+ \qmlmethod list<url> QtCore::StandardPaths::locateAll(StandardLocation type, string fileName, LocateOptions options) const
+
+ \include standardpath/functiondocs.qdocinc locateAll
+
+ \sa QStandardPaths::locateAll()
+*/
+QList<QUrl> QQmlStandardPaths::locateAll(QStandardPaths::StandardLocation type, const QString &fileName,
+ QStandardPaths::LocateOptions options) const
+{
+ return toUrlList(QStandardPaths::locateAll(type, fileName, options));
+}
+
+/*!
+ \qmlmethod list<url> QtCore::StandardPaths::standardLocations(StandardLocation type)
+
+ \include standardpath/functiondocs.qdocinc standardLocations
+
+ \sa QStandardPaths::standardLocations()
+*/
+QList<QUrl> QQmlStandardPaths::standardLocations(QStandardPaths::StandardLocation type) const
+{
+ return toUrlList(QStandardPaths::standardLocations(type));
+}
+
+/*!
+ \qmlmethod url QtCore::StandardPaths::writableLocation(StandardLocation type)
+
+ \include standardpath/functiondocs.qdocinc writableLocation
+
+ \sa QStandardPaths::writableLocation()
+*/
+QUrl QQmlStandardPaths::writableLocation(QStandardPaths::StandardLocation type) const
+{
+ return QUrl::fromLocalFile(QStandardPaths::writableLocation(type));
+}
+
+QT_END_NAMESPACE
diff --git a/src/core/qqmlstandardpaths_p.h b/src/core/qqmlstandardpaths_p.h
new file mode 100644
index 0000000000..dab8adc2ce
--- /dev/null
+++ b/src/core/qqmlstandardpaths_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $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 QQMLSTANDARDPATHS_P_H
+#define QQMLSTANDARDPATHS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobject.h>
+#include <QtCore/qstandardpaths.h>
+#include <QtCore/qurl.h>
+#include <QtQml/qqml.h>
+#include <QtQmlCore/private/qqmlcoreglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlEngine;
+class QJSEngine;
+
+class Q_QMLCORE_PRIVATE_EXPORT QQmlStandardPaths : public QObject
+{
+ Q_OBJECT
+ QML_SINGLETON
+ QML_NAMED_ELEMENT(StandardPaths)
+ QML_ADDED_IN_VERSION(6, 2)
+ QML_EXTENDED_NAMESPACE(QStandardPaths)
+
+public:
+ explicit QQmlStandardPaths(QObject *parent = nullptr);
+
+ Q_INVOKABLE QString displayName(QStandardPaths::StandardLocation type) const;
+ Q_INVOKABLE QUrl findExecutable(const QString &executableName, const QStringList &paths = QStringList()) const;
+ Q_INVOKABLE QUrl locate(QStandardPaths::StandardLocation type, const QString &fileName,
+ QStandardPaths::LocateOptions options = QStandardPaths::LocateFile) const;
+ Q_INVOKABLE QList<QUrl> locateAll(QStandardPaths::StandardLocation type, const QString &fileName,
+ QStandardPaths::LocateOptions options = QStandardPaths::LocateFile) const;
+ Q_INVOKABLE QList<QUrl> standardLocations(QStandardPaths::StandardLocation type) const;
+ Q_INVOKABLE QUrl writableLocation(QStandardPaths::StandardLocation type) const;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQMLSTANDARDPATHS_P_H
diff --git a/src/imports/CMakeLists.txt b/src/imports/CMakeLists.txt
index 623e9c29dd..fbc80b87bd 100644
--- a/src/imports/CMakeLists.txt
+++ b/src/imports/CMakeLists.txt
@@ -2,6 +2,7 @@
add_subdirectory(builtins)
add_subdirectory(qtqml)
+add_subdirectory(core)
add_subdirectory(models)
add_subdirectory(tooling)
if (QT_FEATURE_qml_xmllistmodel)
diff --git a/src/imports/core/CMakeLists.txt b/src/imports/core/CMakeLists.txt
new file mode 100644
index 0000000000..6e4d54e066
--- /dev/null
+++ b/src/imports/core/CMakeLists.txt
@@ -0,0 +1,17 @@
+qt_internal_add_qml_module(qtqmlcoreplugin
+ URI "QtCore"
+ VERSION "${CMAKE_PROJECT_VERSION}"
+ DESIGNER_SUPPORTED
+ CLASS_NAME QtQmlCorePlugin
+ SKIP_TYPE_REGISTRATION
+ DEPENDENCIES
+ QtQml
+ PLUGIN_OPTIONAL
+ SOURCES
+ plugin.cpp
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::Qml
+ Qt::QmlCore
+ Qt::QmlCorePrivate
+)
diff --git a/src/imports/core/plugin.cpp b/src/imports/core/plugin.cpp
new file mode 100644
index 0000000000..dbbddff086
--- /dev/null
+++ b/src/imports/core/plugin.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Layouts module of the Qt Toolkit.
+**
+** $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 <QtQml/qqmlextensionplugin.h>
+#include <QtQmlCore/private/qqmlcoreglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QtQmlCorePlugin : public QQmlEngineExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
+
+public:
+ QtQmlCorePlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent)
+ {
+ volatile auto registration = &qml_register_types_QtCore;
+ Q_UNUSED(registration);
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "plugin.moc"
diff --git a/sync.profile b/sync.profile
index af3c268ef9..23b01bdd19 100644
--- a/sync.profile
+++ b/sync.profile
@@ -1,5 +1,6 @@
%modules = ( # path to module name map
"QtQml" => "$basedir/src/qml",
+ "QtQmlCore" => "$basedir/src/core",
"QtQuick" => "$basedir/src/quick",
"QtQuickShapes" => "$basedir/src/quickshapes",
"QtQuickWidgets" => "$basedir/src/quickwidgets",
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
index 7d3cad8b3a..aad37dcee0 100644
--- a/tests/auto/CMakeLists.txt
+++ b/tests/auto/CMakeLists.txt
@@ -5,6 +5,7 @@ if(TARGET Qt::Quick)
add_subdirectory(quick)
add_subdirectory(quicktest)
endif()
+add_subdirectory(core)
add_subdirectory(qmldevtools)
# special case begin
# add_subdirectory(cmake)
diff --git a/tests/auto/core/CMakeLists.txt b/tests/auto/core/CMakeLists.txt
new file mode 100644
index 0000000000..31413de9c4
--- /dev/null
+++ b/tests/auto/core/CMakeLists.txt
@@ -0,0 +1,16 @@
+# Collect test data
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/data/tst_*)
+list(APPEND test_data ${test_data_glob})
+
+qt_internal_add_test(tst_core
+ GUI
+ QMLTEST
+ SOURCES
+ tst_core.cpp
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::Qml
+ TESTDATA ${test_data}
+)
diff --git a/tests/auto/core/data/tst_standardpaths.qml b/tests/auto/core/data/tst_standardpaths.qml
new file mode 100644
index 0000000000..a2d873bdf0
--- /dev/null
+++ b/tests/auto/core/data/tst_standardpaths.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtCore
+import QtTest
+
+TestCase {
+ id: testCase
+ name: "StandardPaths"
+
+ function test_standardLocation() {
+ // Q_ENUMS(QStandardPaths::StandardLocation)
+ compare(StandardPaths.DesktopLocation, 0)
+ compare(StandardPaths.DocumentsLocation, 1)
+ compare(StandardPaths.FontsLocation, 2)
+ compare(StandardPaths.ApplicationsLocation, 3)
+ compare(StandardPaths.MusicLocation, 4)
+ compare(StandardPaths.MoviesLocation, 5)
+ compare(StandardPaths.PicturesLocation, 6)
+ compare(StandardPaths.TempLocation, 7)
+ compare(StandardPaths.HomeLocation, 8)
+ compare(StandardPaths.AppLocalDataLocation, 9)
+ compare(StandardPaths.CacheLocation, 10)
+ compare(StandardPaths.GenericDataLocation, 11)
+ compare(StandardPaths.RuntimeLocation, 12)
+ compare(StandardPaths.ConfigLocation, 13)
+ compare(StandardPaths.DownloadLocation, 14)
+ compare(StandardPaths.GenericCacheLocation, 15)
+ compare(StandardPaths.GenericConfigLocation, 16)
+ compare(StandardPaths.AppDataLocation, 17)
+ compare(StandardPaths.AppConfigLocation, 18)
+ }
+
+ function test_locateOptions() {
+ // Q_ENUMS(QStandardPaths::LocateOptions)
+ compare(StandardPaths.LocateFile, 0)
+ compare(StandardPaths.LocateDirectory, 1)
+ }
+}
diff --git a/tests/auto/core/tst_core.cpp b/tests/auto/core/tst_core.cpp
new file mode 100644
index 0000000000..c71af0e5aa
--- /dev/null
+++ b/tests/auto/core/tst_core.cpp
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQuickTest/quicktest.h>
+QUICK_TEST_MAIN(tst_core)