aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/builtins/builtins.qmltypes52
-rw-r--r--src/imports/folderlistmodel/fileinfothread.cpp8
-rw-r--r--src/imports/folderlistmodel/fileinfothread_p.h4
-rw-r--r--src/imports/folderlistmodel/folderlistmodel.pro2
-rw-r--r--src/imports/folderlistmodel/plugin.cpp20
-rw-r--r--src/imports/folderlistmodel/plugins.qmltypes19
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.cpp145
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.h12
-rw-r--r--src/imports/imports.pro15
-rw-r--r--src/imports/labsmodels/dependencies.json2
-rw-r--r--src/imports/labsmodels/labsmodels.pro11
-rw-r--r--src/imports/labsmodels/plugin.cpp (renamed from src/imports/shapes/qquicknvprfunctions_p_p.h)56
-rw-r--r--src/imports/labsmodels/plugins.qmltypes41
-rw-r--r--src/imports/labsmodels/qmldir3
-rw-r--r--src/imports/layouts/layouts.pro2
-rw-r--r--src/imports/layouts/plugin.cpp16
-rw-r--r--src/imports/layouts/plugins.qmltypes4
-rw-r--r--src/imports/layouts/qquickgridlayoutengine.cpp2
-rw-r--r--src/imports/layouts/qquicklayout.cpp87
-rw-r--r--src/imports/layouts/qquicklayout_p.h22
-rw-r--r--src/imports/layouts/qquicklayoutstyleinfo_p.h6
-rw-r--r--src/imports/layouts/qquicklinearlayout.cpp10
-rw-r--r--src/imports/layouts/qquicklinearlayout_p.h22
-rw-r--r--src/imports/layouts/qquickstacklayout.cpp11
-rw-r--r--src/imports/layouts/qquickstacklayout_p.h16
-rw-r--r--src/imports/localstorage/dependencies.json2
-rw-r--r--src/imports/localstorage/localstorage.pro2
-rw-r--r--src/imports/localstorage/plugin.cpp235
-rw-r--r--src/imports/localstorage/plugins.qmltypes2
-rw-r--r--src/imports/models/dependencies.json2
-rw-r--r--src/imports/models/models.pro2
-rw-r--r--src/imports/models/plugin.cpp24
-rw-r--r--src/imports/models/plugins.qmltypes477
-rw-r--r--src/imports/particles/particles.pro2
-rw-r--r--src/imports/particles/plugin.cpp16
-rw-r--r--src/imports/particles/plugins.qmltypes4
-rw-r--r--src/imports/qtqml/plugins.qmltypes20
-rw-r--r--src/imports/qtqml/qtqml.pro6
-rw-r--r--src/imports/qtquick2/dependencies.json2
-rw-r--r--src/imports/qtquick2/plugin.cpp13
-rw-r--r--src/imports/qtquick2/plugins.qmltypes521
-rw-r--r--src/imports/qtquick2/qtquick2.pro2
-rw-r--r--src/imports/settings/dependencies.json2
-rw-r--r--src/imports/settings/plugin.cpp12
-rw-r--r--src/imports/settings/plugins.qmltypes20
-rw-r--r--src/imports/settings/qqmlsettings.cpp151
-rw-r--r--src/imports/settings/qqmlsettings_p.h8
-rw-r--r--src/imports/settings/settings.pro2
-rw-r--r--src/imports/shapes/plugin.cpp26
-rw-r--r--src/imports/shapes/plugins.qmltypes252
-rw-r--r--src/imports/shapes/qquicknvprfunctions.cpp277
-rw-r--r--src/imports/shapes/qquicknvprfunctions_p.h400
-rw-r--r--src/imports/shapes/qquickshape.cpp1331
-rw-r--r--src/imports/shapes/qquickshape_p.h287
-rw-r--r--src/imports/shapes/qquickshape_p_p.h281
-rw-r--r--src/imports/shapes/qquickshapegenericrenderer.cpp775
-rw-r--r--src/imports/shapes/qquickshapegenericrenderer_p.h303
-rw-r--r--src/imports/shapes/qquickshapenvprrenderer.cpp923
-rw-r--r--src/imports/shapes/qquickshapenvprrenderer_p.h237
-rw-r--r--src/imports/shapes/qquickshapesoftwarerenderer.cpp277
-rw-r--r--src/imports/shapes/qquickshapesoftwarerenderer_p.h136
-rw-r--r--src/imports/shapes/shapes.pro24
-rw-r--r--src/imports/sharedimage/plugin.cpp2
-rw-r--r--src/imports/sharedimage/plugins.qmltypes11
-rw-r--r--src/imports/sharedimage/qsharedimageloader.cpp13
-rw-r--r--src/imports/sharedimage/qsharedimageloader_p.h4
-rw-r--r--src/imports/sharedimage/sharedimageprovider.cpp2
-rw-r--r--src/imports/statemachine/dependencies.json2
-rw-r--r--src/imports/statemachine/plugin.cpp14
-rw-r--r--src/imports/statemachine/plugins.qmltypes2
-rw-r--r--src/imports/statemachine/signaltransition.cpp21
-rw-r--r--src/imports/statemachine/signaltransition.h14
-rw-r--r--src/imports/statemachine/state.cpp2
-rw-r--r--src/imports/statemachine/statemachine.cpp2
-rw-r--r--src/imports/statemachine/statemachine.pro2
-rw-r--r--src/imports/statemachine/timeouttransition.h2
-rw-r--r--src/imports/testlib/SignalSpy.qml4
-rw-r--r--src/imports/testlib/TestCase.qml265
-rw-r--r--src/imports/testlib/main.cpp34
-rw-r--r--src/imports/testlib/plugins.qmltypes38
-rw-r--r--src/imports/testlib/qmldir1
-rw-r--r--src/imports/testlib/testlib.pro2
-rw-r--r--src/imports/testlib/toucheventsequence.qdoc16
-rw-r--r--src/imports/wavefrontmesh/plugin.cpp (renamed from src/imports/xmllistmodel/plugin.cpp)32
-rw-r--r--src/imports/wavefrontmesh/plugins.qmltypes37
-rw-r--r--src/imports/wavefrontmesh/qmldir4
-rw-r--r--src/imports/wavefrontmesh/qwavefrontmesh.cpp694
-rw-r--r--src/imports/wavefrontmesh/qwavefrontmesh.h110
-rw-r--r--src/imports/wavefrontmesh/wavefrontmesh.pro15
-rw-r--r--src/imports/window/plugin.cpp23
-rw-r--r--src/imports/window/plugins.qmltypes54
-rw-r--r--src/imports/window/window.pro2
-rw-r--r--src/imports/xmllistmodel/plugins.qmltypes59
-rw-r--r--src/imports/xmllistmodel/qmldir5
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel.cpp1207
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel_p.h217
-rw-r--r--src/imports/xmllistmodel/xmllistmodel.pro11
97 files changed, 3034 insertions, 7533 deletions
diff --git a/src/imports/builtins/builtins.qmltypes b/src/imports/builtins/builtins.qmltypes
index c2f8f5b521..4ad103f8de 100644
--- a/src/imports/builtins/builtins.qmltypes
+++ b/src/imports/builtins/builtins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -builtins'
+// 'qmlplugindump -builtins'
Module {
dependencies: []
@@ -427,7 +427,9 @@ Module {
"WA_MacNoShadow": 127,
"WA_AlwaysStackOnTop": 128,
"WA_TabletTracking": 129,
- "WA_AttributeCount": 130
+ "WA_ContentsMarginsRespectsSafeArea": 130,
+ "WA_StyleSheetTarget": 131,
+ "WA_AttributeCount": 132
}
}
Enum {
@@ -461,7 +463,10 @@ Module {
"AA_CompressHighFrequencyEvents": 25,
"AA_DontCheckOpenGLContextThreadAffinity": 26,
"AA_DisableShaderDiskCache": 27,
- "AA_AttributeCount": 28
+ "AA_DontShowShortcutsInContextMenus": 28,
+ "AA_CompressTabletEvents": 29,
+ "AA_DisableWindowContextHelpButton": 30,
+ "AA_AttributeCount": 31
}
}
Enum {
@@ -757,6 +762,36 @@ Module {
"Key_Dead_Belowdot": 16781920,
"Key_Dead_Hook": 16781921,
"Key_Dead_Horn": 16781922,
+ "Key_Dead_Stroke": 16781923,
+ "Key_Dead_Abovecomma": 16781924,
+ "Key_Dead_Abovereversedcomma": 16781925,
+ "Key_Dead_Doublegrave": 16781926,
+ "Key_Dead_Belowring": 16781927,
+ "Key_Dead_Belowmacron": 16781928,
+ "Key_Dead_Belowcircumflex": 16781929,
+ "Key_Dead_Belowtilde": 16781930,
+ "Key_Dead_Belowbreve": 16781931,
+ "Key_Dead_Belowdiaeresis": 16781932,
+ "Key_Dead_Invertedbreve": 16781933,
+ "Key_Dead_Belowcomma": 16781934,
+ "Key_Dead_Currency": 16781935,
+ "Key_Dead_a": 16781952,
+ "Key_Dead_A": 16781953,
+ "Key_Dead_e": 16781954,
+ "Key_Dead_E": 16781955,
+ "Key_Dead_i": 16781956,
+ "Key_Dead_I": 16781957,
+ "Key_Dead_o": 16781958,
+ "Key_Dead_O": 16781959,
+ "Key_Dead_u": 16781960,
+ "Key_Dead_U": 16781961,
+ "Key_Dead_Small_Schwa": 16781962,
+ "Key_Dead_Capital_Schwa": 16781963,
+ "Key_Dead_Greek": 16781964,
+ "Key_Dead_Lowline": 16781968,
+ "Key_Dead_Aboveverticalline": 16781969,
+ "Key_Dead_Belowverticalline": 16781970,
+ "Key_Dead_Longsolidusoverlay": 16781971,
"Key_Back": 16777313,
"Key_Forward": 16777314,
"Key_Stop": 16777315,
@@ -1345,6 +1380,8 @@ Module {
"ImhTime": 256,
"ImhPreferLatin": 512,
"ImhMultiLine": 1024,
+ "ImhNoEditMenu": 2048,
+ "ImhNoTextHandles": 4096,
"ImhDigitsOnly": 65536,
"ImhFormattedNumbersOnly": 131072,
"ImhUppercaseOnly": 262144,
@@ -1371,6 +1408,8 @@ Module {
"ImhTime": 256,
"ImhPreferLatin": 512,
"ImhMultiLine": 1024,
+ "ImhNoEditMenu": 2048,
+ "ImhNoTextHandles": 4096,
"ImhDigitsOnly": 65536,
"ImhFormattedNumbersOnly": 131072,
"ImhUppercaseOnly": 262144,
@@ -1454,10 +1493,10 @@ Module {
"WhatsThisRole": 5,
"FontRole": 6,
"TextAlignmentRole": 7,
- "BackgroundColorRole": 8,
"BackgroundRole": 8,
- "TextColorRole": 9,
"ForegroundRole": 9,
+ "BackgroundColorRole": 8,
+ "TextColorRole": 9,
"CheckStateRole": 10,
"AccessibleTextRole": 11,
"AccessibleDescriptionRole": 12,
@@ -1610,7 +1649,8 @@ Module {
"NoScrollPhase": 0,
"ScrollBegin": 1,
"ScrollUpdate": 2,
- "ScrollEnd": 3
+ "ScrollEnd": 3,
+ "ScrollMomentum": 4
}
}
Enum {
diff --git a/src/imports/folderlistmodel/fileinfothread.cpp b/src/imports/folderlistmodel/fileinfothread.cpp
index d3e256bb7e..a006f659c9 100644
--- a/src/imports/folderlistmodel/fileinfothread.cpp
+++ b/src/imports/folderlistmodel/fileinfothread.cpp
@@ -47,7 +47,7 @@ FileInfoThread::FileInfoThread(QObject *parent)
: QThread(parent),
abort(false),
#if QT_CONFIG(filesystemwatcher)
- watcher(0),
+ watcher(nullptr),
#endif
sortFlags(QDir::Name),
needUpdate(true),
@@ -135,6 +135,7 @@ void FileInfoThread::setSortFlags(QDir::SortFlags flags)
QMutexLocker locker(&mutex);
sortFlags = flags;
sortUpdate = true;
+ needUpdate = true;
condition.wakeAll();
}
@@ -222,8 +223,10 @@ void FileInfoThread::run()
if (abort) {
return;
}
- if (currentPath.isEmpty() || !needUpdate)
+ if (currentPath.isEmpty() || !needUpdate) {
+ emit statusChanged(currentPath.isEmpty() ? QQuickFolderListModel::Null : QQuickFolderListModel::Ready);
condition.wait(&mutex);
+ }
if (abort) {
return;
@@ -231,6 +234,7 @@ void FileInfoThread::run()
if (!currentPath.isEmpty()) {
updateFiles = true;
+ emit statusChanged(QQuickFolderListModel::Loading);
}
if (updateFiles)
getFileInfos(currentPath);
diff --git a/src/imports/folderlistmodel/fileinfothread_p.h b/src/imports/folderlistmodel/fileinfothread_p.h
index b505ece750..438dea6faa 100644
--- a/src/imports/folderlistmodel/fileinfothread_p.h
+++ b/src/imports/folderlistmodel/fileinfothread_p.h
@@ -54,11 +54,14 @@
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
+#if QT_CONFIG(filesystemwatcher)
#include <QFileSystemWatcher>
+#endif
#include <QFileInfo>
#include <QDir>
#include "fileproperty_p.h"
+#include "qquickfolderlistmodel.h"
class FileInfoThread : public QThread
{
@@ -68,6 +71,7 @@ Q_SIGNALS:
void directoryChanged(const QString &directory, const QList<FileProperty> &list) const;
void directoryUpdated(const QString &directory, const QList<FileProperty> &list, int fromIndex, int toIndex) const;
void sortFinished(const QList<FileProperty> &list) const;
+ void statusChanged(QQuickFolderListModel::Status status) const;
public:
FileInfoThread(QObject *parent = 0);
diff --git a/src/imports/folderlistmodel/folderlistmodel.pro b/src/imports/folderlistmodel/folderlistmodel.pro
index 99c54113e4..54ef107e45 100644
--- a/src/imports/folderlistmodel/folderlistmodel.pro
+++ b/src/imports/folderlistmodel/folderlistmodel.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qmlfolderlistmodelplugin
TARGETPATH = Qt/labs/folderlistmodel
-IMPORT_VERSION = 2.1
+IMPORT_VERSION = 2.$$QT_MINOR_VERSION
QT = core-private qml-private
diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp
index ef719109bd..31cd793737 100644
--- a/src/imports/folderlistmodel/plugin.cpp
+++ b/src/imports/folderlistmodel/plugin.cpp
@@ -42,13 +42,6 @@
#include "qquickfolderlistmodel.h"
-static void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_Qt_labs_folderlistmodel);
-#endif
-}
-
QT_BEGIN_NAMESPACE
//![class decl]
@@ -58,14 +51,23 @@ class QmlFolderListModelPlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- QmlFolderListModelPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
- void registerTypes(const char *uri) Q_DECL_OVERRIDE
+ QmlFolderListModelPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
+ void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.folderlistmodel"));
qmlRegisterType<QQuickFolderListModel>(uri,1,0,"FolderListModel");
qmlRegisterType<QQuickFolderListModel>(uri,2,0,"FolderListModel");
qmlRegisterType<QQuickFolderListModel,1>(uri,2,1,"FolderListModel");
qmlRegisterType<QQuickFolderListModel,2>(uri,2,2,"FolderListModel");
+
+ // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward
+ qmlRegisterModule(uri, 2, QT_VERSION_MINOR);
+
+ // revision in Qt 5.11: added status property
+ qmlRegisterType<QQuickFolderListModel,11>(uri, 2, 11, "FolderListModel");
+
+ // revision in Qt 5.12: added sortCaseSensitive property
+ qmlRegisterType<QQuickFolderListModel,12>(uri, 2, 12, "FolderListModel");
}
};
//![class decl]
diff --git a/src/imports/folderlistmodel/plugins.qmltypes b/src/imports/folderlistmodel/plugins.qmltypes
index e77b633932..6f5466dbda 100644
--- a/src/imports/folderlistmodel/plugins.qmltypes
+++ b/src/imports/folderlistmodel/plugins.qmltypes
@@ -4,10 +4,10 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable Qt.labs.folderlistmodel 2.2'
+// 'qmlplugindump -nonrelocatable Qt.labs.folderlistmodel 2.13'
Module {
- dependencies: ["QtQuick 2.8"]
+ dependencies: ["QtQuick 2.0"]
Component {
name: "QQuickFolderListModel"
prototype: "QAbstractListModel"
@@ -15,9 +15,11 @@ Module {
"Qt.labs.folderlistmodel/FolderListModel 1.0",
"Qt.labs.folderlistmodel/FolderListModel 2.0",
"Qt.labs.folderlistmodel/FolderListModel 2.1",
+ "Qt.labs.folderlistmodel/FolderListModel 2.11",
+ "Qt.labs.folderlistmodel/FolderListModel 2.12",
"Qt.labs.folderlistmodel/FolderListModel 2.2"
]
- exportMetaObjectRevisions: [0, 0, 1, 2]
+ exportMetaObjectRevisions: [0, 0, 1, 11, 12, 2]
Enum {
name: "SortField"
values: {
@@ -28,6 +30,14 @@ Module {
"Type": 4
}
}
+ Enum {
+ name: "Status"
+ values: {
+ "Null": 0,
+ "Ready": 1,
+ "Loading": 2
+ }
+ }
Property { name: "folder"; type: "QUrl" }
Property { name: "rootFolder"; type: "QUrl" }
Property { name: "parentFolder"; type: "QUrl"; isReadonly: true }
@@ -42,8 +52,11 @@ Module {
Property { name: "showOnlyReadable"; type: "bool" }
Property { name: "caseSensitive"; revision: 2; type: "bool" }
Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "status"; revision: 11; type: "Status"; isReadonly: true }
+ Property { name: "sortCaseSensitive"; revision: 12; type: "bool" }
Signal { name: "rowCountChanged" }
Signal { name: "countChanged"; revision: 1 }
+ Signal { name: "statusChanged"; revision: 11 }
Method {
name: "isFolder"
type: "bool"
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
index fdcce9c685..affb1e9fe2 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
@@ -51,15 +51,7 @@ class QQuickFolderListModelPrivate
Q_DECLARE_PUBLIC(QQuickFolderListModel)
public:
- QQuickFolderListModelPrivate(QQuickFolderListModel *q)
- : q_ptr(q),
- sortField(QQuickFolderListModel::Name), sortReversed(false), showFiles(true),
- showDirs(true), showDirsFirst(false), showDotAndDotDot(false), showOnlyReadable(false),
- showHidden(false), caseSensitive(true)
- {
- nameFilters << QLatin1String("*");
- }
-
+ QQuickFolderListModelPrivate(QQuickFolderListModel *q) : q_ptr(q) { }
QQuickFolderListModel *q_ptr;
QUrl currentDir;
@@ -67,16 +59,18 @@ public:
FileInfoThread fileInfoThread;
QList<FileProperty> data;
QHash<int, QByteArray> roleNames;
- QQuickFolderListModel::SortField sortField;
- QStringList nameFilters;
- bool sortReversed;
- bool showFiles;
- bool showDirs;
- bool showDirsFirst;
- bool showDotAndDotDot;
- bool showOnlyReadable;
- bool showHidden;
- bool caseSensitive;
+ QQuickFolderListModel::SortField sortField = QQuickFolderListModel::Name;
+ QStringList nameFilters = { QLatin1String("*") };
+ QQuickFolderListModel::Status status = QQuickFolderListModel::Null;
+ bool sortReversed = false;
+ bool showFiles = true;
+ bool showDirs = true;
+ bool showDirsFirst = false;
+ bool showDotAndDotDot = false;
+ bool showOnlyReadable = false;
+ bool showHidden = false;
+ bool caseSensitive = true;
+ bool sortCaseSensitive = true;
~QQuickFolderListModelPrivate() {}
void init();
@@ -86,6 +80,7 @@ public:
void _q_directoryChanged(const QString &directory, const QList<FileProperty> &list);
void _q_directoryUpdated(const QString &directory, const QList<FileProperty> &list, int fromIndex, int toIndex);
void _q_sortFinished(const QList<FileProperty> &list);
+ void _q_statusChanged(QQuickFolderListModel::Status s);
static QString resolvePath(const QUrl &path);
};
@@ -95,12 +90,15 @@ void QQuickFolderListModelPrivate::init()
{
Q_Q(QQuickFolderListModel);
qRegisterMetaType<QList<FileProperty> >("QList<FileProperty>");
+ qRegisterMetaType<QQuickFolderListModel::Status>("QQuickFolderListModel::Status");
q->connect(&fileInfoThread, SIGNAL(directoryChanged(QString,QList<FileProperty>)),
q, SLOT(_q_directoryChanged(QString,QList<FileProperty>)));
q->connect(&fileInfoThread, SIGNAL(directoryUpdated(QString,QList<FileProperty>,int,int)),
q, SLOT(_q_directoryUpdated(QString,QList<FileProperty>,int,int)));
q->connect(&fileInfoThread, SIGNAL(sortFinished(QList<FileProperty>)),
q, SLOT(_q_sortFinished(QList<FileProperty>)));
+ q->connect(&fileInfoThread, SIGNAL(statusChanged(QQuickFolderListModel::Status)),
+ q, SLOT(_q_statusChanged(QQuickFolderListModel::Status)));
q->connect(q, SIGNAL(rowCountChanged()), q, SIGNAL(countChanged()));
}
@@ -109,7 +107,7 @@ void QQuickFolderListModelPrivate::updateSorting()
{
Q_Q(QQuickFolderListModel);
- QDir::SortFlags flags = 0;
+ QDir::SortFlags flags = nullptr;
switch (sortField) {
case QQuickFolderListModel::Unsorted:
@@ -127,14 +125,14 @@ void QQuickFolderListModelPrivate::updateSorting()
case QQuickFolderListModel::Type:
flags |= QDir::Type;
break;
- default:
- break;
}
emit q->layoutAboutToBeChanged();
if (sortReversed)
flags |= QDir::Reversed;
+ if (!sortCaseSensitive)
+ flags |= QDir::IgnoreCase;
fileInfoThread.setSortFlags(flags);
}
@@ -198,6 +196,16 @@ void QQuickFolderListModelPrivate::_q_sortFinished(const QList<FileProperty> &li
q->endInsertRows();
}
+void QQuickFolderListModelPrivate::_q_statusChanged(QQuickFolderListModel::Status s)
+{
+ Q_Q(QQuickFolderListModel);
+
+ if (status != s) {
+ status = s;
+ emit q->statusChanged();
+ }
+}
+
QString QQuickFolderListModelPrivate::resolvePath(const QUrl &path)
{
QString localPath = QQmlFile::urlToLocalFileOrQrc(path);
@@ -209,16 +217,16 @@ QString QQuickFolderListModelPrivate::resolvePath(const QUrl &path)
}
/*!
- \qmlmodule Qt.labs.folderlistmodel 2.1
+ \qmlmodule Qt.labs.folderlistmodel 2.\QtMinorVersion
\title Qt Labs FolderListModel QML Types
\ingroup qmlmodules
\brief The FolderListModel provides a model of the contents of a file system folder.
To use this module, import the module with the following line:
- \code
- import Qt.labs.folderlistmodel 2.1
- \endcode
+ \qml \QtMinorVersion
+ import Qt.labs.folderlistmodel 2.\1
+ \endqml
*/
@@ -236,7 +244,9 @@ QString QQuickFolderListModelPrivate::resolvePath(const QUrl &path)
\e{Elements in the Qt.labs module are not guaranteed to remain compatible
in future versions.}
- \b{import Qt.labs.folderlistmodel 2.1}
+ \qml \QtMinorVersion
+ import Qt.labs.folderlistmodel 2.\1
+ \endqml
The \l folder property specifies the folder to access. Information about the
files and directories in the folder is supplied via the model's interface.
@@ -280,9 +290,9 @@ QString QQuickFolderListModelPrivate::resolvePath(const QUrl &path)
The following example shows a FolderListModel being used to provide a list
of QML files in a \l ListView:
- \qml
- import QtQuick 2.0
- import Qt.labs.folderlistmodel 2.1
+ \qml \QtMinorVersion
+ import QtQuick 2.\1
+ import Qt.labs.folderlistmodel 2.\1
ListView {
width: 200; height: 400
@@ -400,14 +410,14 @@ QModelIndex QQuickFolderListModel::index(int row, int , const QModelIndex &) con
}
/*!
- \qmlproperty string FolderListModel::folder
+ \qmlproperty url FolderListModel::folder
- The \a folder property holds a URL for the folder that the model is
- currently providing.
+ The \a folder property holds a URL for the folder that the model
+ currently provides.
The value must be a \c file: or \c qrc: URL, or a relative URL.
- By default, the value is an invalid URL.
+ The default value is an invalid URL.
*/
QUrl QQuickFolderListModel::folder() const
{
@@ -437,6 +447,10 @@ void QQuickFolderListModel::setFolder(const QUrl &folder)
d->data.clear();
endResetModel();
emit rowCountChanged();
+ if (d->status != QQuickFolderListModel::Null) {
+ d->status = QQuickFolderListModel::Null;
+ emit statusChanged();
+ }
return;
}
@@ -795,6 +809,69 @@ void QQuickFolderListModel::setCaseSensitive(bool on)
}
/*!
+ \qmlproperty enumeration FolderListModel::status
+ \since 5.11
+
+ This property holds the status of folder reading. It can be one of:
+ \list
+ \li FolderListModel.Null - no \a folder has been set
+ \li FolderListModel.Ready - the folder has been loaded
+ \li FolderListModel.Loading - the folder is currently being loaded
+ \endlist
+
+ Use this status to provide an update or respond to the status change in some way.
+ For example, you could:
+
+ \list
+ \li Trigger a state change:
+ \qml
+ State { name: 'loaded'; when: folderModel.status == FolderListModel.Ready }
+ \endqml
+
+ \li Implement an \c onStatusChanged signal handler:
+ \qml
+ FolderListModel {
+ id: folderModel
+ onStatusChanged: if (folderModel.status == FolderListModel.Ready) console.log('Loaded')
+ }
+ \endqml
+
+ \li Bind to the status value:
+ \qml
+ Text { text: folderModel.status == FolderListModel.Ready ? 'Loaded' : 'Not loaded' }
+ \endqml
+ \endlist
+*/
+QQuickFolderListModel::Status QQuickFolderListModel::status() const
+{
+ Q_D(const QQuickFolderListModel);
+ return d->status;
+}
+
+/*!
+ \qmlproperty bool FolderListModel::sortCaseSensitive
+ \since 5.12
+
+ If set to true, the sort is case sensitive. This property is true by default.
+*/
+
+bool QQuickFolderListModel::sortCaseSensitive() const
+{
+ Q_D(const QQuickFolderListModel);
+ return d->sortCaseSensitive;
+}
+
+void QQuickFolderListModel::setSortCaseSensitive(bool on)
+{
+ Q_D(QQuickFolderListModel);
+
+ if (on != d->sortCaseSensitive) {
+ d->sortCaseSensitive = on;
+ d->updateSorting();
+ }
+}
+
+/*!
\qmlmethod var FolderListModel::get(int index, string property)
Get the folder property for the given index. The following properties
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.h b/src/imports/folderlistmodel/qquickfolderlistmodel.h
index dee73dff3e..d93e7daf3f 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.h
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.h
@@ -75,11 +75,13 @@ class QQuickFolderListModel : public QAbstractListModel, public QQmlParserStatus
Q_PROPERTY(bool showOnlyReadable READ showOnlyReadable WRITE setShowOnlyReadable)
Q_PROPERTY(bool caseSensitive READ caseSensitive WRITE setCaseSensitive REVISION 2)
Q_PROPERTY(int count READ count NOTIFY countChanged)
+ Q_PROPERTY(Status status READ status NOTIFY statusChanged REVISION 11)
+ Q_PROPERTY(bool sortCaseSensitive READ sortCaseSensitive WRITE setSortCaseSensitive REVISION 12)
//![class props]
//![abslistmodel]
public:
- QQuickFolderListModel(QObject *parent = 0);
+ QQuickFolderListModel(QObject *parent = nullptr);
~QQuickFolderListModel();
enum Roles {
@@ -137,6 +139,12 @@ public:
void setShowOnlyReadable(bool on);
bool caseSensitive() const;
void setCaseSensitive(bool on);
+
+ enum Status { Null, Ready, Loading };
+ Q_ENUM(Status)
+ Status status() const;
+ bool sortCaseSensitive() const;
+ void setSortCaseSensitive(bool on);
//![prop funcs]
Q_INVOKABLE bool isFolder(int index) const;
@@ -155,6 +163,7 @@ Q_SIGNALS:
void folderChanged();
void rowCountChanged() const;
Q_REVISION(1) void countChanged() const;
+ Q_REVISION(11) void statusChanged();
//![notifier]
//![class end]
@@ -168,6 +177,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_directoryChanged(const QString &directory, const QList<FileProperty> &list))
Q_PRIVATE_SLOT(d_func(), void _q_directoryUpdated(const QString &directory, const QList<FileProperty> &list, int fromIndex, int toIndex))
Q_PRIVATE_SLOT(d_func(), void _q_sortFinished(const QList<FileProperty> &list))
+ Q_PRIVATE_SLOT(d_func(), void _q_statusChanged(QQuickFolderListModel::Status s))
};
//![class end]
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index 3c7f96eff9..24e93fec1c 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -1,29 +1,30 @@
TEMPLATE = subdirs
-QT_FOR_CONFIG += quick-private
-
SUBDIRS += \
builtins \
qtqml \
- folderlistmodel \
- models
+ models \
+ labsmodels
+qtConfig(thread): SUBDIRS += folderlistmodel
qtHaveModule(sql): SUBDIRS += localstorage
qtConfig(settings): SUBDIRS += settings
qtConfig(statemachine): SUBDIRS += statemachine
qtHaveModule(quick) {
+ QT_FOR_CONFIG += quick-private
+
SUBDIRS += \
layouts \
qtquick2 \
window \
- testlib
+ wavefrontmesh
+ qtHaveModule(testlib): SUBDIRS += testlib
qtConfig(systemsemaphore): SUBDIRS += sharedimage
qtConfig(quick-particles): \
SUBDIRS += particles
- SUBDIRS += shapes
+ qtConfig(quick-path):qtConfig(thread): SUBDIRS += shapes
}
-qtHaveModule(xmlpatterns) : SUBDIRS += xmllistmodel
diff --git a/src/imports/labsmodels/dependencies.json b/src/imports/labsmodels/dependencies.json
new file mode 100644
index 0000000000..0d4f101c7a
--- /dev/null
+++ b/src/imports/labsmodels/dependencies.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/src/imports/labsmodels/labsmodels.pro b/src/imports/labsmodels/labsmodels.pro
new file mode 100644
index 0000000000..1795ae5e43
--- /dev/null
+++ b/src/imports/labsmodels/labsmodels.pro
@@ -0,0 +1,11 @@
+CXX_MODULE = qml
+TARGET = labsmodelsplugin
+TARGETPATH = Qt/labs/qmlmodels
+IMPORT_VERSION = 1.0
+
+SOURCES += \
+ plugin.cpp
+
+QT = qml-private
+
+load(qml_plugin)
diff --git a/src/imports/shapes/qquicknvprfunctions_p_p.h b/src/imports/labsmodels/plugin.cpp
index 6df20566af..cebc1dc920 100644
--- a/src/imports/shapes/qquicknvprfunctions_p_p.h
+++ b/src/imports/labsmodels/plugin.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the QtQuick module of the Qt Toolkit.
+** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,34 +37,46 @@
**
****************************************************************************/
-#ifndef QQUICKNVPRFUNCTIONS_P_P_H
-#define QQUICKNVPRFUNCTIONS_P_P_H
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of a number of Qt sources files. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qquicknvprfunctions_p.h"
+#include <private/qqmlmodelsmodule_p.h>
QT_BEGIN_NAMESPACE
-class QQuickNvprFunctionsPrivate
+/*!
+ \qmlmodule Qt.labs.qmlmodels 1.0
+ \title Qt QML Models experimental QML Types
+ \ingroup qmlmodules
+ \brief Provides QML experimental types for data models
+ \since 5.12
+
+ This QML module contains experimental QML types related to data models.
+
+ To use the types in this module, import the module with the following line:
+
+ \code
+ import Qt.labs.qmlmodels 1.0
+ \endcode
+*/
+
+//![class decl]
+class QtQmlLabsModelsPlugin : public QQmlExtensionPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- QQuickNvprFunctionsPrivate(QQuickNvprFunctions *q_ptr) : q(q_ptr) { }
-
- bool resolve();
+ QtQmlLabsModelsPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
+ void registerTypes(const char *uri) override
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.qmlmodels"));
+ QQmlModelsModule::defineLabsModule();
- QQuickNvprFunctions *q;
+ qmlRegisterModule(uri, 1, 0);
+ }
};
+//![class decl]
QT_END_NAMESPACE
-#endif // QQUICKNVPRFUNCTIONS_P_P_H
+#include "plugin.moc"
diff --git a/src/imports/labsmodels/plugins.qmltypes b/src/imports/labsmodels/plugins.qmltypes
new file mode 100644
index 0000000000..6272069060
--- /dev/null
+++ b/src/imports/labsmodels/plugins.qmltypes
@@ -0,0 +1,41 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt.labs.qmlmodels 1.0'
+
+Module {
+ dependencies: []
+ Component {
+ name: "QQmlAbstractDelegateComponent"
+ prototype: "QQmlComponent"
+ exports: ["Qt.labs.qmlmodels/AbstractDelegateComponent 1.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Signal { name: "delegateChanged" }
+ }
+ Component {
+ name: "QQmlDelegateChoice"
+ defaultProperty: "delegate"
+ prototype: "QObject"
+ exports: ["Qt.labs.qmlmodels/DelegateChoice 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "roleValue"; type: "QVariant" }
+ Property { name: "row"; type: "int" }
+ Property { name: "index"; type: "int" }
+ Property { name: "column"; type: "int" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Signal { name: "changed" }
+ }
+ Component {
+ name: "QQmlDelegateChooser"
+ defaultProperty: "choices"
+ prototype: "QQmlAbstractDelegateComponent"
+ exports: ["Qt.labs.qmlmodels/DelegateChooser 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "role"; type: "string" }
+ Property { name: "choices"; type: "QQmlDelegateChoice"; isList: true; isReadonly: true }
+ }
+}
diff --git a/src/imports/labsmodels/qmldir b/src/imports/labsmodels/qmldir
new file mode 100644
index 0000000000..9c735711c4
--- /dev/null
+++ b/src/imports/labsmodels/qmldir
@@ -0,0 +1,3 @@
+module Qt.labs.qmlmodels
+plugin labsmodelsplugin
+classname QtQmlLabsModelsPlugin
diff --git a/src/imports/layouts/layouts.pro b/src/imports/layouts/layouts.pro
index 26574150de..addf396746 100644
--- a/src/imports/layouts/layouts.pro
+++ b/src/imports/layouts/layouts.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qquicklayoutsplugin
TARGETPATH = QtQuick/Layouts
-IMPORT_VERSION = 1.2
+IMPORT_VERSION = 1.$$QT_MINOR_VERSION
QT *= qml-private quick-private gui-private core-private
diff --git a/src/imports/layouts/plugin.cpp b/src/imports/layouts/plugin.cpp
index da5f264ab5..d28109c3cf 100644
--- a/src/imports/layouts/plugin.cpp
+++ b/src/imports/layouts/plugin.cpp
@@ -42,13 +42,6 @@
#include "qquicklinearlayout_p.h"
#include "qquickstacklayout_p.h"
-static void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQuick_Layouts);
-#endif
-}
-
QT_BEGIN_NAMESPACE
//![class decl]
@@ -57,14 +50,12 @@ class QtQuickLayoutsPlugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- QtQuickLayoutsPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent)
+ QtQuickLayoutsPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent)
{
- initResources();
}
- void registerTypes(const char *uri) Q_DECL_OVERRIDE
+ void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Layouts"));
- Q_UNUSED(uri);
qmlRegisterType<QQuickRowLayout>(uri, 1, 0, "RowLayout");
qmlRegisterType<QQuickColumnLayout>(uri, 1, 0, "ColumnLayout");
@@ -75,6 +66,9 @@ public:
qmlRegisterUncreatableType<QQuickLayout>(uri, 1, 2, "Layout",
QStringLiteral("Do not create objects of type Layout"));
qmlRegisterRevision<QQuickGridLayoutBase, 1>(uri, 1, 1);
+
+ // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward
+ qmlRegisterModule(uri, 1, QT_VERSION_MINOR);
}
};
//![class decl]
diff --git a/src/imports/layouts/plugins.qmltypes b/src/imports/layouts/plugins.qmltypes
index afb563391d..22e8d79ece 100644
--- a/src/imports/layouts/plugins.qmltypes
+++ b/src/imports/layouts/plugins.qmltypes
@@ -4,10 +4,10 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtQuick.Layouts 1.3'
+// 'qmlplugindump -nonrelocatable QtQuick.Layouts 1.13'
Module {
- dependencies: ["QtQuick 2.8"]
+ dependencies: ["QtQuick 2.0"]
Component {
name: "QQuickColumnLayout"
defaultProperty: "data"
diff --git a/src/imports/layouts/qquickgridlayoutengine.cpp b/src/imports/layouts/qquickgridlayoutengine.cpp
index fe716f0694..6004bb92ca 100644
--- a/src/imports/layouts/qquickgridlayoutengine.cpp
+++ b/src/imports/layouts/qquickgridlayoutengine.cpp
@@ -55,7 +55,7 @@ Qt::Alignment QQuickGridLayoutEngine::alignment(QQuickItem *quickItem) const
{
if (QGridLayoutItem *item = findLayoutItem(quickItem))
return item->alignment();
- return 0;
+ return nullptr;
}
QT_END_NAMESPACE
diff --git a/src/imports/layouts/qquicklayout.cpp b/src/imports/layouts/qquicklayout.cpp
index df64b593d9..450cf26cea 100644
--- a/src/imports/layouts/qquicklayout.cpp
+++ b/src/imports/layouts/qquicklayout.cpp
@@ -74,10 +74,14 @@
false, the item's size will be fixed to its preferred size. Otherwise, it will grow or shrink
between its minimum and maximum size as the layout is resized.
- \note It is not recommended to have bindings to the x, y, width, or height properties of items
- in a layout, since this would conflict with the goals of Layout, and can also cause binding
- loops.
-
+ \note Do not bind to the x, y, width, or height properties of items in a layout,
+ as this would conflict with the goals of Layout, and can also cause binding loops.
+ The width and height properties are used by the layout engine to store the current
+ size of items as calculated from the minimum/preferred/maximum attached properties,
+ and can be ovewritten each time the items are laid out. Use
+ \l {Layout::preferredWidth}{Layout.preferredWidth} and
+ \l {Layout::preferredHeight}{Layout.preferredHeight}, or \l {Item::}{implicitWidth}
+ and \l {Item::}{implicitHeight} to specify the preferred size of items.
\sa GridLayout
\sa RowLayout
@@ -95,6 +99,8 @@ QQuickLayoutAttached::QQuickLayoutAttached(QObject *parent)
m_maximumWidth(std::numeric_limits<qreal>::infinity()),
m_maximumHeight(std::numeric_limits<qreal>::infinity()),
m_defaultMargins(0),
+ m_fallbackWidth(-1),
+ m_fallbackHeight(-1),
m_row(-1),
m_column(-1),
m_rowSpan(1),
@@ -112,7 +118,7 @@ QQuickLayoutAttached::QQuickLayoutAttached(QObject *parent)
m_isTopMarginSet(false),
m_isRightMarginSet(false),
m_isBottomMarginSet(false),
- m_alignment(0)
+ m_alignment(nullptr)
{
}
@@ -405,7 +411,11 @@ void QQuickLayoutAttached::setColumn(int column)
This property allows you to specify the alignment of an item within the cell(s) it occupies.
- The default value is \c 0, which means it will be \c{Qt.AlignVCenter | Qt.AlignLeft}
+ The default value is \c 0, which means it will be \c{Qt.AlignVCenter | Qt.AlignLeft}.
+ These defaults also apply if only a horizontal or vertical flag is specified:
+ if only a horizontal flag is specified, the default vertical flag will be
+ \c Qt.AlignVCenter, and if only a vertical flag is specified, the default
+ horizontal flag will be \c Qt.AlignLeft.
A valid alignment is a combination of the following flags:
\list
@@ -681,7 +691,7 @@ QQuickLayout *QQuickLayoutAttached::parentLayout() const
} else {
qmlWarning(parent()) << "Layout must be attached to Item elements";
}
- return 0;
+ return nullptr;
}
QQuickItem *QQuickLayoutAttached::item() const
@@ -762,11 +772,21 @@ bool QQuickLayout::shouldIgnoreItem(QQuickItem *child, QQuickLayoutAttached *&in
ignoreItem = effectiveMaxSize.isNull();
}
+ if (!ignoreItem && childPrivate->isTransparentForPositioner())
+ ignoreItem = true;
+
if (ignoreItem)
d->m_ignoredItems << child;
return ignoreItem;
}
+void QQuickLayout::checkAnchors(QQuickItem *item) const
+{
+ QQuickAnchors *anchors = QQuickItemPrivate::get(item)->_anchors;
+ if (anchors && anchors->activeDirections())
+ qmlWarning(item) << "Detected anchors on an item that is managed by a layout. This is undefined behavior; use Layout.alignment instead.";
+}
+
void QQuickLayout::itemChange(ItemChange change, const ItemChangeData &value)
{
if (change == ItemChildAddedChange) {
@@ -1049,39 +1069,32 @@ void QQuickLayout::effectiveSizeHints_helper(QQuickItem *item, QSizeF *cachedSiz
prefHeight = qCeil(item->implicitHeight());
// If that fails, make an ultimate fallback to width/height
-
- if (!info && (prefWidth < 0 || prefHeight < 0))
- info = attachedLayoutObject(item);
-
- if (useFallbackToWidthOrHeight && info) {
- /* This block is a bit hacky, but if we want to support using width/height
- as preferred size hints in layouts, (which we think most people expect),
- we only want to use the initial width.
- This is because the width will change due to layout rearrangement, and the preferred
- width should return the same value, regardless of the current width.
- We therefore store the width in the implicitWidth attached property.
- Since the layout listens to changes of implicitWidth, (it will
- basically cause an invalidation of the layout), we have to disable that
- notification while we set the implicit width (and height).
-
- Only use this fallback the first time the size hint is queried. Otherwise, we might
- end up picking a width that is different than what was specified in the QML.
+ if (useFallbackToWidthOrHeight && !prefS.isValid()) {
+ /* If we want to support using width/height as preferred size hints in
+ layouts, (which we think most people expect), we only want to use the
+ initial width.
+ This is because the width will change due to layout rearrangement,
+ and the preferred width should return the same value, regardless of
+ the current width.
+ We therefore store this initial width in the attached layout object
+ and reuse it if needed rather than querying the width another time.
+ That means we need to ensure that an Layout attached object is available
+ by creating one if necessary.
*/
- if (prefWidth < 0 || prefHeight < 0) {
- item->blockSignals(true);
- if (prefWidth < 0) {
- prefWidth = item->width();
- item->setImplicitWidth(prefWidth);
- }
- if (prefHeight < 0) {
- prefHeight = item->height();
- item->setImplicitHeight(prefHeight);
- }
- item->blockSignals(false);
- }
- }
+ if (!info)
+ info = attachedLayoutObject(item);
+ auto updatePreferredSizes = [](qreal &cachedSize, qreal &attachedSize, qreal size) {
+ if (cachedSize < 0) {
+ if (attachedSize < 0)
+ attachedSize = size;
+ cachedSize = attachedSize;
+ }
+ };
+ updatePreferredSizes(prefWidth, info->m_fallbackWidth, item->width());
+ updatePreferredSizes(prefHeight, info->m_fallbackHeight, item->height());
+ }
// Normalize again after the implicit hints have been gathered
expandSize(prefS, minS);
diff --git a/src/imports/layouts/qquicklayout_p.h b/src/imports/layouts/qquicklayout_p.h
index 113498eb2b..b31bffa290 100644
--- a/src/imports/layouts/qquicklayout_p.h
+++ b/src/imports/layouts/qquicklayout_p.h
@@ -75,7 +75,7 @@ public:
static QQuickLayoutAttached *qmlAttachedProperties(QObject *object);
- void componentComplete() Q_DECL_OVERRIDE;
+ void componentComplete() override;
virtual QSizeF sizeHint(Qt::SizeHint whichSizeHint) const = 0;
virtual void setAlignment(QQuickItem *item, Qt::Alignment align) = 0;
virtual void invalidate(QQuickItem * childItem = 0);
@@ -91,22 +91,23 @@ public:
static void effectiveSizeHints_helper(QQuickItem *item, QSizeF *cachedSizeHints, QQuickLayoutAttached **info, bool useFallbackToWidthOrHeight);
static QLayoutPolicy::Policy effectiveSizePolicy_helper(QQuickItem *item, Qt::Orientation orientation, QQuickLayoutAttached *info);
bool shouldIgnoreItem(QQuickItem *child, QQuickLayoutAttached *&info, QSizeF *sizeHints) const;
+ void checkAnchors(QQuickItem *item) const;
- void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void itemChange(ItemChange change, const ItemChangeData &value) override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
bool isReady() const;
void deactivateRecur();
/* QQuickItemChangeListener */
- void itemSiblingOrderChanged(QQuickItem *item) Q_DECL_OVERRIDE;
- void itemImplicitWidthChanged(QQuickItem *item) Q_DECL_OVERRIDE;
- void itemImplicitHeightChanged(QQuickItem *item) Q_DECL_OVERRIDE;
- void itemDestroyed(QQuickItem *item) Q_DECL_OVERRIDE;
- void itemVisibilityChanged(QQuickItem *item) Q_DECL_OVERRIDE;
+ void itemSiblingOrderChanged(QQuickItem *item) override;
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+ void itemDestroyed(QQuickItem *item) override;
+ void itemVisibilityChanged(QQuickItem *item) override;
protected:
- void updatePolish() Q_DECL_OVERRIDE;
+ void updatePolish() override;
enum Orientation {
Vertical = 0,
@@ -294,6 +295,9 @@ private:
qreal m_defaultMargins;
QMarginsF m_margins;
+ qreal m_fallbackWidth;
+ qreal m_fallbackHeight;
+
// GridLayout specific properties
int m_row;
int m_column;
diff --git a/src/imports/layouts/qquicklayoutstyleinfo_p.h b/src/imports/layouts/qquicklayoutstyleinfo_p.h
index ce86c2a37d..79f4ce2962 100644
--- a/src/imports/layouts/qquicklayoutstyleinfo_p.h
+++ b/src/imports/layouts/qquicklayoutstyleinfo_p.h
@@ -49,9 +49,9 @@ class QQuickLayoutStyleInfo : public QAbstractLayoutStyleInfo
public:
QQuickLayoutStyleInfo();
- qreal spacing(Qt::Orientation orientation) const Q_DECL_OVERRIDE;
- qreal windowMargin(Qt::Orientation orientation) const Q_DECL_OVERRIDE;
- bool hasChangedCore() const Q_DECL_OVERRIDE;
+ qreal spacing(Qt::Orientation orientation) const override;
+ qreal windowMargin(Qt::Orientation orientation) const override;
+ bool hasChangedCore() const override;
};
diff --git a/src/imports/layouts/qquicklinearlayout.cpp b/src/imports/layouts/qquicklinearlayout.cpp
index 4410723f3d..fa51ef1f2f 100644
--- a/src/imports/layouts/qquicklinearlayout.cpp
+++ b/src/imports/layouts/qquicklinearlayout.cpp
@@ -652,13 +652,14 @@ void QQuickGridLayout::insertLayoutItems()
QSizeF sizeHints[Qt::NSizeHints];
const auto items = childItems();
for (QQuickItem *child : items) {
- QQuickLayoutAttached *info = 0;
+ checkAnchors(child);
+ QQuickLayoutAttached *info = nullptr;
// Will skip all items with effective maximum width/height == 0
if (shouldIgnoreItem(child, info, sizeHints))
continue;
- Qt::Alignment alignment = 0;
+ Qt::Alignment alignment = nullptr;
int row = -1;
int column = -1;
int span[2] = {1,1};
@@ -826,13 +827,14 @@ void QQuickLinearLayout::insertLayoutItems()
const auto items = childItems();
for (QQuickItem *child : items) {
Q_ASSERT(child);
- QQuickLayoutAttached *info = 0;
+ checkAnchors(child);
+ QQuickLayoutAttached *info = nullptr;
// Will skip all items with effective maximum width/height == 0
if (shouldIgnoreItem(child, info, sizeHints))
continue;
- Qt::Alignment alignment = 0;
+ Qt::Alignment alignment = nullptr;
if (info)
alignment = info->alignment();
diff --git a/src/imports/layouts/qquicklinearlayout_p.h b/src/imports/layouts/qquicklinearlayout_p.h
index f796c8a855..6706ebf9fa 100644
--- a/src/imports/layouts/qquicklinearlayout_p.h
+++ b/src/imports/layouts/qquicklinearlayout_p.h
@@ -67,26 +67,26 @@ public:
QQuickItem *parent = 0);
~QQuickGridLayoutBase();
- void componentComplete() Q_DECL_OVERRIDE;
- void invalidate(QQuickItem *childItem = 0) Q_DECL_OVERRIDE;
+ void componentComplete() override;
+ void invalidate(QQuickItem *childItem = 0) override;
Qt::Orientation orientation() const;
void setOrientation(Qt::Orientation orientation);
- QSizeF sizeHint(Qt::SizeHint whichSizeHint) const Q_DECL_OVERRIDE;
+ QSizeF sizeHint(Qt::SizeHint whichSizeHint) const override;
Qt::LayoutDirection layoutDirection() const;
void setLayoutDirection(Qt::LayoutDirection dir);
Qt::LayoutDirection effectiveLayoutDirection() const;
- void setAlignment(QQuickItem *item, Qt::Alignment align) Q_DECL_OVERRIDE;
+ void setAlignment(QQuickItem *item, Qt::Alignment align) override;
/* QQuickItemChangeListener */
- void itemDestroyed(QQuickItem *item) Q_DECL_OVERRIDE;
- void itemVisibilityChanged(QQuickItem *item) Q_DECL_OVERRIDE;
+ void itemDestroyed(QQuickItem *item) override;
+ void itemVisibilityChanged(QQuickItem *item) override;
protected:
- void updateLayoutItems() Q_DECL_OVERRIDE;
- QQuickItem *itemAt(int index) const Q_DECL_OVERRIDE;
- int itemCount() const Q_DECL_OVERRIDE;
+ void updateLayoutItems() override;
+ QQuickItem *itemAt(int index) const override;
+ int itemCount() const override;
- void rearrange(const QSizeF &size) Q_DECL_OVERRIDE;
+ void rearrange(const QSizeF &size) override;
virtual void insertLayoutItems() {}
signals:
@@ -109,7 +109,7 @@ public:
, m_layoutDirection(Qt::LeftToRight)
{}
- void mirrorChange() Q_DECL_OVERRIDE
+ void mirrorChange() override
{
Q_Q(QQuickGridLayoutBase);
q->invalidate();
diff --git a/src/imports/layouts/qquickstacklayout.cpp b/src/imports/layouts/qquickstacklayout.cpp
index 9a7ec71473..0b51d79bef 100644
--- a/src/imports/layouts/qquickstacklayout.cpp
+++ b/src/imports/layouts/qquickstacklayout.cpp
@@ -213,7 +213,7 @@ QQuickItem *QQuickStackLayout::itemAt(int index) const
return item;
--index;
}
- return 0;
+ return nullptr;
}
int QQuickStackLayout::itemCount() const
@@ -288,8 +288,11 @@ void QQuickStackLayout::updateLayoutItems()
d->count = count;
emit countChanged();
}
- for (int i = 0; i < count; ++i)
- itemAt(i)->setVisible(d->currentIndex == i);
+ for (int i = 0; i < count; ++i) {
+ QQuickItem *child = itemAt(i);
+ checkAnchors(child);
+ child->setVisible(d->currentIndex == i);
+ }
invalidate();
}
@@ -317,7 +320,7 @@ void QQuickStackLayout::rearrange(const QSizeF &newSize)
void QQuickStackLayout::collectItemSizeHints(QQuickItem *item, QSizeF *sizeHints)
{
- QQuickLayoutAttached *info = 0;
+ QQuickLayoutAttached *info = nullptr;
QQuickLayout::effectiveSizeHints_helper(item, sizeHints, &info, true);
if (!info)
return;
diff --git a/src/imports/layouts/qquickstacklayout_p.h b/src/imports/layouts/qquickstacklayout_p.h
index 7b6400c3a3..8ba41720aa 100644
--- a/src/imports/layouts/qquickstacklayout_p.h
+++ b/src/imports/layouts/qquickstacklayout_p.h
@@ -56,16 +56,16 @@ public:
int currentIndex() const;
void setCurrentIndex(int index);
- void componentComplete() Q_DECL_OVERRIDE;
- QSizeF sizeHint(Qt::SizeHint whichSizeHint) const Q_DECL_OVERRIDE;
- void setAlignment(QQuickItem *item, Qt::Alignment align) Q_DECL_OVERRIDE;
- void invalidate(QQuickItem *childItem = 0) Q_DECL_OVERRIDE;
- void updateLayoutItems() Q_DECL_OVERRIDE;
- void rearrange(const QSizeF &) Q_DECL_OVERRIDE;
+ void componentComplete() override;
+ QSizeF sizeHint(Qt::SizeHint whichSizeHint) const override;
+ void setAlignment(QQuickItem *item, Qt::Alignment align) override;
+ void invalidate(QQuickItem *childItem = 0) override;
+ void updateLayoutItems() override;
+ void rearrange(const QSizeF &) override;
// iterator
- Q_INVOKABLE QQuickItem *itemAt(int index) const Q_DECL_OVERRIDE;
- int itemCount() const Q_DECL_OVERRIDE;
+ Q_INVOKABLE QQuickItem *itemAt(int index) const override;
+ int itemCount() const override;
int indexOf(QQuickItem *item) const;
diff --git a/src/imports/localstorage/dependencies.json b/src/imports/localstorage/dependencies.json
new file mode 100644
index 0000000000..0d4f101c7a
--- /dev/null
+++ b/src/imports/localstorage/dependencies.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/src/imports/localstorage/localstorage.pro b/src/imports/localstorage/localstorage.pro
index 15753263b8..5c8177e238 100644
--- a/src/imports/localstorage/localstorage.pro
+++ b/src/imports/localstorage/localstorage.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qmllocalstorageplugin
TARGETPATH = QtQuick/LocalStorage
-IMPORT_VERSION = 2.0
+IMPORT_VERSION = 2.$$QT_MINOR_VERSION
QT = sql qml-private core-private
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index a7d95cc295..3c34d8e45a 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -58,21 +58,15 @@
#include <private/qv4functionobject_p.h>
#include <private/qv4objectproto_p.h>
#include <private/qv4scopedvalue_p.h>
+#include <private/qv4jscall_p.h>
#include <private/qv4objectiterator_p.h>
-static void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQuick_LocalStorage);
-#endif
-}
-
QT_BEGIN_NAMESPACE
#define V4THROW_SQL(error, desc) { \
QV4::ScopedString v(scope, scope.engine->newString(desc)); \
QV4::ScopedObject ex(scope, scope.engine->newErrorObject(v)); \
- ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))).getPointer(), QV4::ScopedValue(scope, Primitive::fromInt32(error))); \
+ ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))).getPointer(), QV4::ScopedValue(scope, Value::fromInt32(error))); \
scope.engine->throwError(ex); \
RETURN_UNDEFINED(); \
}
@@ -80,7 +74,7 @@ QT_BEGIN_NAMESPACE
#define V4THROW_SQL2(error, desc) { \
QV4::ScopedString v(scope, scope.engine->newString(desc)); \
QV4::ScopedObject ex(scope, scope.engine->newErrorObject(v)); \
- ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))).getPointer(), QV4::ScopedValue(scope, Primitive::fromInt32(error))); \
+ ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))).getPointer(), QV4::ScopedValue(scope, Value::fromInt32(error))); \
args->setReturnValue(scope.engine->throwError(ex)); \
return; \
}
@@ -96,7 +90,7 @@ class QQmlSqlDatabaseData : public QV8Engine::Deletable
{
public:
QQmlSqlDatabaseData(QV4::ExecutionEngine *engine);
- ~QQmlSqlDatabaseData();
+ ~QQmlSqlDatabaseData() override;
QV4::PersistentValue databaseProto;
QV4::PersistentValue queryProto;
@@ -147,13 +141,13 @@ public:
static Heap::QQmlSqlDatabaseWrapper *create(QV4::ExecutionEngine *engine)
{
- return engine->memoryManager->allocObject<QQmlSqlDatabaseWrapper>();
+ return engine->memoryManager->allocate<QQmlSqlDatabaseWrapper>();
}
~QQmlSqlDatabaseWrapper() {
}
- static ReturnedValue getIndexed(const Managed *m, uint index, bool *hasProperty);
+ static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
};
}
@@ -164,18 +158,20 @@ DEFINE_OBJECT_VTABLE(QV4::QQmlSqlDatabaseWrapper);
-static void qmlsqldatabase_version(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData)
+static ReturnedValue qmlsqldatabase_version(const FunctionObject *b, const Value *thisObject, const QV4::Value *, int)
{
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, callData->thisObject.as<QQmlSqlDatabaseWrapper>());
+ Scope scope(b);
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, thisObject->as<QQmlSqlDatabaseWrapper>());
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Database)
V4THROW_REFERENCE("Not a SQLDatabase object");
RETURN_RESULT(Encode(scope.engine->newString(*r->d()->version)));
}
-static void qmlsqldatabase_rows_length(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData)
+static ReturnedValue qmlsqldatabase_rows_length(const FunctionObject *b, const Value *thisObject, const QV4::Value *, int)
{
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, callData->thisObject.as<QQmlSqlDatabaseWrapper>());
+ Scope scope(b);
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, thisObject->as<QQmlSqlDatabaseWrapper>());
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows)
V4THROW_REFERENCE("Not a SQLDatabase::Rows object");
@@ -191,23 +187,25 @@ static void qmlsqldatabase_rows_length(const QV4::BuiltinFunction *, QV4::Scope
RETURN_RESULT(Encode(s));
}
-static void qmlsqldatabase_rows_forwardOnly(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData)
+static ReturnedValue qmlsqldatabase_rows_forwardOnly(const FunctionObject *b, const Value *thisObject, const QV4::Value *, int)
{
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, callData->thisObject.as<QQmlSqlDatabaseWrapper>());
+ Scope scope(b);
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, thisObject->as<QQmlSqlDatabaseWrapper>());
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows)
V4THROW_REFERENCE("Not a SQLDatabase::Rows object");
RETURN_RESULT(Encode(r->d()->sqlQuery->isForwardOnly()));
}
-static void qmlsqldatabase_rows_setForwardOnly(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData)
+static ReturnedValue qmlsqldatabase_rows_setForwardOnly(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
{
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, callData->thisObject.as<QQmlSqlDatabaseWrapper>());
+ Scope scope(b);
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, thisObject->as<QQmlSqlDatabaseWrapper>());
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows)
V4THROW_REFERENCE("Not a SQLDatabase::Rows object");
- if (callData->argc < 1)
+ if (argc < 1)
RETURN_RESULT(scope.engine->throwTypeError());
- r->d()->sqlQuery->setForwardOnly(callData->args[0].toBoolean());
+ r->d()->sqlQuery->setForwardOnly(argv[0].toBoolean());
RETURN_UNDEFINED();
}
@@ -215,7 +213,7 @@ QQmlSqlDatabaseData::~QQmlSqlDatabaseData()
{
}
-static ReturnedValue qmlsqldatabase_rows_index(const QQmlSqlDatabaseWrapper *r, ExecutionEngine *v4, quint32 index, bool *hasProperty = 0)
+static ReturnedValue qmlsqldatabase_rows_index(const QQmlSqlDatabaseWrapper *r, ExecutionEngine *v4, quint32 index, bool *hasProperty = nullptr)
{
Scope scope(v4);
@@ -239,23 +237,28 @@ static ReturnedValue qmlsqldatabase_rows_index(const QQmlSqlDatabaseWrapper *r,
}
}
-ReturnedValue QQmlSqlDatabaseWrapper::getIndexed(const Managed *m, uint index, bool *hasProperty)
+ReturnedValue QQmlSqlDatabaseWrapper::virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)
{
+ if (!id.isArrayIndex())
+ return Object::virtualGet(m, id, receiver, hasProperty);
+
+ uint index = id.asArrayIndex();
Q_ASSERT(m->as<QQmlSqlDatabaseWrapper>());
const QQmlSqlDatabaseWrapper *r = static_cast<const QQmlSqlDatabaseWrapper *>(m);
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows)
- return Object::getIndexed(m, index, hasProperty);
+ return Object::virtualGet(m, id, receiver, hasProperty);
return qmlsqldatabase_rows_index(r, r->engine(), index, hasProperty);
}
-static void qmlsqldatabase_rows_item(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData)
+static ReturnedValue qmlsqldatabase_rows_item(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
{
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, callData->thisObject.as<QQmlSqlDatabaseWrapper>());
+ Scope scope(b);
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, thisObject->as<QQmlSqlDatabaseWrapper>());
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows)
V4THROW_REFERENCE("Not a SQLDatabase::Rows object");
- RETURN_RESULT(qmlsqldatabase_rows_index(r, scope.engine, callData->argc ? callData->args[0].toUInt32() : 0));
+ RETURN_RESULT(qmlsqldatabase_rows_index(r, scope.engine, argc ? argv[0].toUInt32() : 0));
}
static QVariant toSqlVariant(QV4::ExecutionEngine *engine, const QV4::ScopedValue &value)
@@ -267,9 +270,10 @@ static QVariant toSqlVariant(QV4::ExecutionEngine *engine, const QV4::ScopedValu
return engine->toVariant(value, /*typehint*/-1);
}
-static void qmlsqldatabase_executeSql(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData)
+static ReturnedValue qmlsqldatabase_executeSql(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
{
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, callData->thisObject.as<QQmlSqlDatabaseWrapper>());
+ Scope scope(b);
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, thisObject->as<QQmlSqlDatabaseWrapper>());
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Query)
V4THROW_REFERENCE("Not a SQLDatabase::Query object");
@@ -278,7 +282,7 @@ static void qmlsqldatabase_executeSql(const QV4::BuiltinFunction *, QV4::Scope &
QSqlDatabase db = *r->d()->database;
- QString sql = callData->argc ? callData->args[0].toQString() : QString();
+ QString sql = argc ? argv[0].toQString() : QString();
if (r->d()->readonly && !sql.startsWith(QLatin1String("SELECT"),Qt::CaseInsensitive)) {
V4THROW_SQL(SQLEXCEPTION_SYNTAX_ERR, QQmlEngine::tr("Read-only Transaction"));
@@ -287,21 +291,21 @@ static void qmlsqldatabase_executeSql(const QV4::BuiltinFunction *, QV4::Scope &
QSqlQuery query(db);
bool err = false;
- ScopedValue result(scope, Primitive::undefinedValue());
+ ScopedValue result(scope, Value::undefinedValue());
if (query.prepare(sql)) {
- if (callData->argc > 1) {
- ScopedValue values(scope, callData->args[1]);
+ if (argc > 1) {
+ ScopedValue values(scope, argv[1]);
if (values->as<ArrayObject>()) {
ScopedArrayObject array(scope, values);
quint32 size = array->getLength();
QV4::ScopedValue v(scope);
for (quint32 ii = 0; ii < size; ++ii) {
- query.bindValue(ii, toSqlVariant(scope.engine, (v = array->getIndexed(ii))));
+ query.bindValue(ii, toSqlVariant(scope.engine, (v = array->get(ii))));
}
} else if (values->as<Object>()) {
ScopedObject object(scope, values);
- ObjectIterator it(scope, object, ObjectIterator::WithProtoChain|ObjectIterator::EnumerableOnly);
+ ObjectIterator it(scope, object, ObjectIterator::EnumerableOnly);
ScopedValue key(scope);
QV4::ScopedValue val(scope);
while (1) {
@@ -323,7 +327,7 @@ static void qmlsqldatabase_executeSql(const QV4::BuiltinFunction *, QV4::Scope &
if (query.exec()) {
QV4::Scoped<QQmlSqlDatabaseWrapper> rows(scope, QQmlSqlDatabaseWrapper::create(scope.engine));
QV4::ScopedObject p(scope, databaseData(scope.engine)->rowsProto.value());
- rows->setPrototype(p.getPointer());
+ rows->setPrototypeUnchecked(p.getPointer());
rows->d()->type = Heap::QQmlSqlDatabaseWrapper::Rows;
*rows->d()->database = db;
*rows->d()->sqlQuery = query;
@@ -333,7 +337,7 @@ static void qmlsqldatabase_executeSql(const QV4::BuiltinFunction *, QV4::Scope &
// XXX optimize
ScopedString s(scope);
ScopedValue v(scope);
- resultObject->put((s = scope.engine->newIdentifier("rowsAffected")).getPointer(), (v = Primitive::fromInt32(query.numRowsAffected())));
+ resultObject->put((s = scope.engine->newIdentifier("rowsAffected")).getPointer(), (v = Value::fromInt32(query.numRowsAffected())));
resultObject->put((s = scope.engine->newIdentifier("insertId")).getPointer(), (v = scope.engine->newString(query.lastInsertId().toString())));
resultObject->put((s = scope.engine->newIdentifier("rows")).getPointer(), rows);
} else {
@@ -369,49 +373,50 @@ struct TransactionRollback {
}
void clear() {
- db = 0;
+ db = nullptr;
if (inTransactionFlag)
*inTransactionFlag = false;
- inTransactionFlag = 0;
+ inTransactionFlag = nullptr;
}
};
-static void qmlsqldatabase_changeVersion(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData)
+static ReturnedValue qmlsqldatabase_changeVersion(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
{
- if (callData->argc < 2)
+ Scope scope(b);
+ if (argc < 2)
RETURN_UNDEFINED();
- Scoped<QQmlSqlDatabaseWrapper> r(scope, callData->thisObject);
+ Scoped<QQmlSqlDatabaseWrapper> r(scope, *thisObject);
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Database)
V4THROW_REFERENCE("Not a SQLDatabase object");
QSqlDatabase db = *r->d()->database;
- QString from_version = callData->args[0].toQString();
- QString to_version = callData->args[1].toQString();
- ScopedFunctionObject callback(scope, callData->argc > 2 ? callData->args[2] : Primitive::undefinedValue());
+ QString from_version = argv[0].toQString();
+ QString to_version = argv[1].toQString();
+ ScopedFunctionObject callback(scope, argc > 2 ? argv[2] : Value::undefinedValue());
if (from_version != *r->d()->version)
V4THROW_SQL(SQLEXCEPTION_VERSION_ERR, QQmlEngine::tr("Version mismatch: expected %1, found %2").arg(from_version).arg(*r->d()->version));
- Scoped<QQmlSqlDatabaseWrapper> w(scope, QQmlSqlDatabaseWrapper::create(scope.engine));
- ScopedObject p(scope, databaseData(scope.engine)->queryProto.value());
- w->setPrototype(p.getPointer());
- w->d()->type = Heap::QQmlSqlDatabaseWrapper::Query;
- *w->d()->database = db;
- *w->d()->version = *r->d()->version;
-
bool ok = true;
if (!!callback) {
+ Scoped<QQmlSqlDatabaseWrapper> query(scope, QQmlSqlDatabaseWrapper::create(scope.engine));
+ ScopedObject p(scope, databaseData(scope.engine)->queryProto.value());
+ query->setPrototypeUnchecked(p.getPointer());
+ query->d()->type = Heap::QQmlSqlDatabaseWrapper::Query;
+ *query->d()->database = db;
+ *query->d()->version = *r->d()->version;
+
ok = false;
db.transaction();
- ScopedCallData callData(scope, 1);
- callData->thisObject = scope.engine->globalObject;
- callData->args[0] = w;
+ JSCallData jsCall(scope, 1);
+ *jsCall->thisObject = scope.engine->globalObject;
+ jsCall->args[0] = query;
- TransactionRollback rollbackOnException(&db, &w->d()->inTransaction);
- callback->call(scope, callData);
+ TransactionRollback rollbackOnException(&db, &query->d()->inTransaction);
+ callback->call(jsCall);
rollbackOnException.clear();
if (!db.commit()) {
db.rollback();
@@ -422,24 +427,31 @@ static void qmlsqldatabase_changeVersion(const QV4::BuiltinFunction *, QV4::Scop
}
if (ok) {
+ Scoped<QQmlSqlDatabaseWrapper> w(scope, QQmlSqlDatabaseWrapper::create(scope.engine));
+ ScopedObject p(scope, databaseData(scope.engine)->databaseProto.value());
+ w->setPrototypeUnchecked(p.getPointer());
+ w->d()->type = Heap::QQmlSqlDatabaseWrapper::Database;
+ *w->d()->database = db;
*w->d()->version = to_version;
#if QT_CONFIG(settings)
const QQmlEnginePrivate *enginePrivate = QQmlEnginePrivate::get(scope.engine->qmlEngine());
QSettings ini(enginePrivate->offlineStorageDatabaseDirectory() + db.connectionName() + QLatin1String(".ini"), QSettings::IniFormat);
ini.setValue(QLatin1String("Version"), to_version);
#endif
+ RETURN_RESULT(w.asReturnedValue());
}
RETURN_UNDEFINED();
}
-static void qmlsqldatabase_transaction_shared(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData, bool readOnly)
+static ReturnedValue qmlsqldatabase_transaction_shared(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc, bool readOnly)
{
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, callData->thisObject.as<QQmlSqlDatabaseWrapper>());
+ Scope scope(b);
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, thisObject->as<QQmlSqlDatabaseWrapper>());
if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Database)
V4THROW_REFERENCE("Not a SQLDatabase object");
- const FunctionObject *callback = callData->argc ? callData->args[0].as<FunctionObject>() : 0;
+ const FunctionObject *callback = argc ? argv[0].as<FunctionObject>() : nullptr;
if (!callback)
V4THROW_SQL(SQLEXCEPTION_UNKNOWN_ERR, QQmlEngine::tr("transaction: missing callback"));
@@ -447,7 +459,7 @@ static void qmlsqldatabase_transaction_shared(const QV4::BuiltinFunction *, QV4:
Scoped<QQmlSqlDatabaseWrapper> w(scope, QQmlSqlDatabaseWrapper::create(scope.engine));
QV4::ScopedObject p(scope, databaseData(scope.engine)->queryProto.value());
- w->setPrototype(p.getPointer());
+ w->setPrototypeUnchecked(p.getPointer());
w->d()->type = Heap::QQmlSqlDatabaseWrapper::Query;
*w->d()->database = db;
*w->d()->version = *r->d()->version;
@@ -455,11 +467,11 @@ static void qmlsqldatabase_transaction_shared(const QV4::BuiltinFunction *, QV4:
db.transaction();
if (callback) {
- ScopedCallData callData(scope, 1);
- callData->thisObject = scope.engine->globalObject;
- callData->args[0] = w;
+ JSCallData jsCall(scope, 1);
+ *jsCall->thisObject = scope.engine->globalObject;
+ jsCall->args[0] = w;
TransactionRollback rollbackOnException(&db, &w->d()->inTransaction);
- callback->call(scope, callData);
+ callback->call(jsCall);
rollbackOnException.clear();
if (!db.commit())
@@ -469,14 +481,14 @@ static void qmlsqldatabase_transaction_shared(const QV4::BuiltinFunction *, QV4:
RETURN_UNDEFINED();
}
-static void qmlsqldatabase_transaction(const QV4::BuiltinFunction *f, QV4::Scope &scope, QV4::CallData *callData)
+static ReturnedValue qmlsqldatabase_transaction(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
{
- qmlsqldatabase_transaction_shared(f, scope, callData, false);
+ return qmlsqldatabase_transaction_shared(f, thisObject, argv, argc, false);
}
-static void qmlsqldatabase_read_transaction(const QV4::BuiltinFunction *f, QV4::Scope &scope, QV4::CallData *callData)
+static ReturnedValue qmlsqldatabase_read_transaction(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
{
- qmlsqldatabase_transaction_shared(f, scope, callData, true);
+ return qmlsqldatabase_transaction_shared(f, thisObject, argv, argc, true);
}
QQmlSqlDatabaseData::QQmlSqlDatabaseData(ExecutionEngine *v4)
@@ -486,7 +498,7 @@ QQmlSqlDatabaseData::QQmlSqlDatabaseData(ExecutionEngine *v4)
ScopedObject proto(scope, v4->newObject());
proto->defineDefaultProperty(QStringLiteral("transaction"), qmlsqldatabase_transaction);
proto->defineDefaultProperty(QStringLiteral("readTransaction"), qmlsqldatabase_read_transaction);
- proto->defineAccessorProperty(QStringLiteral("version"), qmlsqldatabase_version, 0);
+ proto->defineAccessorProperty(QStringLiteral("version"), qmlsqldatabase_version, nullptr);
proto->defineDefaultProperty(QStringLiteral("changeVersion"), qmlsqldatabase_changeVersion);
databaseProto = proto;
}
@@ -499,7 +511,7 @@ QQmlSqlDatabaseData::QQmlSqlDatabaseData(ExecutionEngine *v4)
{
ScopedObject proto(scope, v4->newObject());
proto->defineDefaultProperty(QStringLiteral("item"), qmlsqldatabase_rows_item);
- proto->defineAccessorProperty(QStringLiteral("length"), qmlsqldatabase_rows_length, 0);
+ proto->defineAccessorProperty(QStringLiteral("length"), qmlsqldatabase_rows_length, nullptr);
proto->defineAccessorProperty(QStringLiteral("forwardOnly"),
qmlsqldatabase_rows_forwardOnly, qmlsqldatabase_rows_setForwardOnly);
rowsProto = proto;
@@ -514,7 +526,7 @@ through the data.
/*!
- \qmlmodule QtQuick.LocalStorage 2
+ \qmlmodule QtQuick.LocalStorage 2.\QtMinorVersion
\title Qt Quick Local Storage QML Types
\ingroup qmlmodules
\brief Provides a JavaScript object singleton type for accessing a local
@@ -535,16 +547,16 @@ through the data.
To use the types in this module, import the module and call the
relevant functions using the \c LocalStorage type:
- \code
- import QtQuick.LocalStorage 2.0
- import QtQuick 2.0
+ \qml \QtMinorVersion
+ import QtQuick 2.\1
+ import QtQuick.LocalStorage 2.\1
Item {
Component.onCompleted: {
var db = LocalStorage.openDatabaseSync(...)
}
}
- \endcode
+ \endqml
These databases are user-specific and QML-specific, but accessible to all QML applications.
@@ -563,12 +575,14 @@ The API conforms to the Synchronous API of the HTML5 Web Database API,
The \l{Qt Quick Examples - Local Storage}{SQL Local Storage example} demonstrates the basics of
using the Offline Storage API.
-\section3 Open or create a databaseData
-\code
-import QtQuick.LocalStorage 2.0 as Sql
+\section3 Open or Create a Database
+
+\qml \QtMinorVersion
+import QtQuick.LocalStorage 2.\1 as Sql
db = Sql.openDatabaseSync(identifier, version, description, estimated_size, callback(db))
-\endcode
+\endqml
+
The above code returns the database identified by \e identifier. If the database does not already exist, it
is created, and the function \e callback is called with the database as a parameter. \e identifier is the
name of the physical file (with or without full path) containing the database. \e description and
@@ -591,7 +605,8 @@ This data can be used by application tools.
\section3 db.changeVersion(from, to, callback(tx))
-This method allows you to perform a \e{Scheme Upgrade}.
+This method allows you to perform a \e{Scheme Upgrade}. If it succeeds it returns a new
+database object of version \e to. Otherwise it returns \e undefined.
If the current version of \e db is not \e from, then an exception is thrown.
@@ -602,7 +617,15 @@ May throw exception with code property SQLException.DATABASE_ERR or SQLException
See example below.
-\snippet qml/localstorage/dbtransaction.js 2
+\badcode
+ var db = LocalStorage.openDatabaseSync("ActivityTrackDB", "", "Database tracking sports activities", 1000000);
+ if (db.version == "0.1") {
+ db.changeVersion("0.1", "0.2", function(tx) {
+ tx.executeSql("INSERT INTO trip_log VALUES(?, ?, ?)",
+ [ "01/10/2016","Sylling - Vikersund", "53" ]);
+ }
+ });
+\endcode
\section3 db.transaction(callback(tx))
@@ -612,7 +635,10 @@ you can call \e executeSql on \e tx to read and modify the database.
If the callback throws exceptions, the transaction is rolled back.
Below you will find an example of a database transaction which catches exceptions.
-\snippet qml/localstorage/dbtransaction.js 0
+
+\quotefromfile localstorage/localstorage/Database.js
+\skipuntil dbInit()
+\printto dbGetHandle
In the example you can see an \c insert statement where values are assigned to the fields,
and the record is written into the table. That is an \c insert statement with a syntax that is usual
@@ -622,15 +648,24 @@ store them in a table.
Let's suppose a simple example where we store trips in JSON format using \c date as the unique key.
An example of a table that could be used for that purpose:
-\snippet qml/localstorage/dbtransaction.js 3
+\badcode
+ create table trip_log(date text, data text)
+\endcode
The assignment of values to a JSON object:
-\snippet qml/localstorage/dbtransaction.js 4
+\badcode
+ var obj = {description = "Vikersund - Noresund", distance = "60"}
+\endcode
In that case, the data could be saved in the following way:
-\snippet qml/localstorage/dbtransaction.js 5
+\badcode
+ db.transaction(function(tx) {
+ result = tx.executeSQL("insert into trip_log values (?,?)",
+ ["01/11/2016", JSON.stringify(obj)])
+
+\endcode
\section3 db.readTransaction(callback(tx))
@@ -655,7 +690,9 @@ May throw exception with code property SQLException.DATABASE_ERR, SQLException.S
See below for an example:
-\snippet qml/localstorage/dbtransaction.js 1
+\quotefromfile localstorage/localstorage/Database.js
+\skipto dbReadAll()
+\printto dbUpdate(Pdate
\section1 Method Documentation
@@ -681,10 +718,10 @@ class QQuickLocalStorage : public QObject
{
Q_OBJECT
public:
- QQuickLocalStorage(QObject *parent=0) : QObject(parent)
+ QQuickLocalStorage(QObject *parent=nullptr) : QObject(parent)
{
}
- ~QQuickLocalStorage() {
+ ~QQuickLocalStorage() override {
}
Q_INVOKABLE void openDatabaseSync(QQmlV4Function* args);
@@ -749,15 +786,15 @@ void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args)
QV4::Scoped<QQmlSqlDatabaseWrapper> db(scope, QQmlSqlDatabaseWrapper::create(scope.engine));
QV4::ScopedObject p(scope, databaseData(scope.engine)->databaseProto.value());
- db->setPrototype(p.getPointer());
+ db->setPrototypeUnchecked(p.getPointer());
*db->d()->database = database;
*db->d()->version = version;
if (created && dbcreationCallback) {
- ScopedCallData callData(scope, 1);
- callData->thisObject = scope.engine->globalObject;
- callData->args[0] = db;
- dbcreationCallback->call(scope, callData);
+ JSCallData jsCall(scope, 1);
+ *jsCall->thisObject = scope.engine->globalObject;
+ jsCall->args[0] = db;
+ dbcreationCallback->call(jsCall);
}
args->setReturnValue(db.asReturnedValue());
@@ -781,14 +818,16 @@ class QQmlLocalStoragePlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- QQmlLocalStoragePlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent)
+ QQmlLocalStoragePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent)
{
- initResources();
}
- void registerTypes(const char *uri) Q_DECL_OVERRIDE
+ void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.LocalStorage"));
qmlRegisterSingletonType<QQuickLocalStorage>(uri, 2, 0, "LocalStorage", module_api_factory);
+
+ // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward
+ qmlRegisterModule(uri, 2, QT_VERSION_MINOR);
}
};
diff --git a/src/imports/localstorage/plugins.qmltypes b/src/imports/localstorage/plugins.qmltypes
index dee81a78d0..3c8c1404f2 100644
--- a/src/imports/localstorage/plugins.qmltypes
+++ b/src/imports/localstorage/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -noforceqtquick QtQuick.LocalStorage 2.0'
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.LocalStorage 2.13'
Module {
dependencies: []
diff --git a/src/imports/models/dependencies.json b/src/imports/models/dependencies.json
new file mode 100644
index 0000000000..0d4f101c7a
--- /dev/null
+++ b/src/imports/models/dependencies.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/src/imports/models/models.pro b/src/imports/models/models.pro
index c94ba833ad..fc87533cea 100644
--- a/src/imports/models/models.pro
+++ b/src/imports/models/models.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = modelsplugin
TARGETPATH = QtQml/Models.2
-IMPORT_VERSION = 2.3
+IMPORT_VERSION = 2.$$QT_MINOR_VERSION
SOURCES += \
plugin.cpp
diff --git a/src/imports/models/plugin.cpp b/src/imports/models/plugin.cpp
index dbb62cd25d..9fe63412f3 100644
--- a/src/imports/models/plugin.cpp
+++ b/src/imports/models/plugin.cpp
@@ -38,20 +38,14 @@
****************************************************************************/
#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
#include <private/qqmlmodelsmodule_p.h>
-static void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQml_Models_2);
-#endif
-}
-
QT_BEGIN_NAMESPACE
/*!
- \qmlmodule QtQml.Models 2.2
+ \qmlmodule QtQml.Models 2.\QtMinorVersion
\title Qt QML Models QML Types
\ingroup qmlmodules
\brief Provides QML types for data models
@@ -61,9 +55,9 @@ QT_BEGIN_NAMESPACE
To use the types in this module, import the module with the following line:
- \code
- import QtQml.Models 2.2
- \endcode
+ \qml \QtMinorVersion
+ import QtQml.Models 2.\1
+ \endqml
Note that QtQml.Models module started at version 2.1 to match the version
of the parent module, \l{Qt QML}.
@@ -77,12 +71,14 @@ class QtQmlModelsPlugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- QtQmlModelsPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
- void registerTypes(const char *uri) Q_DECL_OVERRIDE
+ QtQmlModelsPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
+ void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQml.Models"));
- Q_UNUSED(uri);
QQmlModelsModule::defineModule();
+
+ // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward
+ qmlRegisterModule(uri, 2, QT_VERSION_MINOR);
}
};
//![class decl]
diff --git a/src/imports/models/plugins.qmltypes b/src/imports/models/plugins.qmltypes
index aa06a2a709..6e112c41b6 100644
--- a/src/imports/models/plugins.qmltypes
+++ b/src/imports/models/plugins.qmltypes
@@ -4,10 +4,284 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtQml.Models 2.3'
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQml.Models 2.13'
Module {
- dependencies: ["QtQuick 2.8"]
+ dependencies: []
+ Component {
+ name: "QAbstractItemModel"
+ prototype: "QObject"
+ Enum {
+ name: "LayoutChangeHint"
+ values: {
+ "NoLayoutChangeHint": 0,
+ "VerticalSortHint": 1,
+ "HorizontalSortHint": 2
+ }
+ }
+ Enum {
+ name: "CheckIndexOption"
+ values: {
+ "NoOption": 0,
+ "IndexIsValid": 1,
+ "DoNotUseParent": 2,
+ "ParentIsInvalid": 4
+ }
+ }
+ Signal {
+ name: "dataChanged"
+ Parameter { name: "topLeft"; type: "QModelIndex" }
+ Parameter { name: "bottomRight"; type: "QModelIndex" }
+ Parameter { name: "roles"; type: "QVector<int>" }
+ }
+ Signal {
+ name: "dataChanged"
+ Parameter { name: "topLeft"; type: "QModelIndex" }
+ Parameter { name: "bottomRight"; type: "QModelIndex" }
+ }
+ Signal {
+ name: "headerDataChanged"
+ Parameter { name: "orientation"; type: "Qt::Orientation" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "layoutChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" }
+ }
+ Signal {
+ name: "layoutChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ }
+ Signal { name: "layoutChanged" }
+ Signal {
+ name: "layoutAboutToBeChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" }
+ }
+ Signal {
+ name: "layoutAboutToBeChanged"
+ Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" }
+ }
+ Signal { name: "layoutAboutToBeChanged" }
+ Signal {
+ name: "rowsAboutToBeInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "rowsInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "rowsAboutToBeRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "rowsRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsAboutToBeInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsInserted"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsAboutToBeRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal {
+ name: "columnsRemoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "first"; type: "int" }
+ Parameter { name: "last"; type: "int" }
+ }
+ Signal { name: "modelAboutToBeReset" }
+ Signal { name: "modelReset" }
+ Signal {
+ name: "rowsAboutToBeMoved"
+ Parameter { name: "sourceParent"; type: "QModelIndex" }
+ Parameter { name: "sourceStart"; type: "int" }
+ Parameter { name: "sourceEnd"; type: "int" }
+ Parameter { name: "destinationParent"; type: "QModelIndex" }
+ Parameter { name: "destinationRow"; type: "int" }
+ }
+ Signal {
+ name: "rowsMoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ Parameter { name: "destination"; type: "QModelIndex" }
+ Parameter { name: "row"; type: "int" }
+ }
+ Signal {
+ name: "columnsAboutToBeMoved"
+ Parameter { name: "sourceParent"; type: "QModelIndex" }
+ Parameter { name: "sourceStart"; type: "int" }
+ Parameter { name: "sourceEnd"; type: "int" }
+ Parameter { name: "destinationParent"; type: "QModelIndex" }
+ Parameter { name: "destinationColumn"; type: "int" }
+ }
+ Signal {
+ name: "columnsMoved"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ Parameter { name: "destination"; type: "QModelIndex" }
+ Parameter { name: "column"; type: "int" }
+ }
+ Method { name: "submit"; type: "bool" }
+ Method { name: "revert" }
+ Method {
+ name: "hasIndex"
+ type: "bool"
+ Parameter { name: "row"; type: "int" }
+ Parameter { name: "column"; type: "int" }
+ Parameter { name: "parent"; type: "QModelIndex" }
+ }
+ Method {
+ name: "hasIndex"
+ type: "bool"
+ Parameter { name: "row"; type: "int" }
+ Parameter { name: "column"; type: "int" }
+ }
+ Method {
+ name: "index"
+ type: "QModelIndex"
+ Parameter { name: "row"; type: "int" }
+ Parameter { name: "column"; type: "int" }
+ Parameter { name: "parent"; type: "QModelIndex" }
+ }
+ Method {
+ name: "index"
+ type: "QModelIndex"
+ Parameter { name: "row"; type: "int" }
+ Parameter { name: "column"; type: "int" }
+ }
+ Method {
+ name: "parent"
+ type: "QModelIndex"
+ Parameter { name: "child"; type: "QModelIndex" }
+ }
+ Method {
+ name: "sibling"
+ type: "QModelIndex"
+ Parameter { name: "row"; type: "int" }
+ Parameter { name: "column"; type: "int" }
+ Parameter { name: "idx"; type: "QModelIndex" }
+ }
+ Method {
+ name: "rowCount"
+ type: "int"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ }
+ Method { name: "rowCount"; type: "int" }
+ Method {
+ name: "columnCount"
+ type: "int"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ }
+ Method { name: "columnCount"; type: "int" }
+ Method {
+ name: "hasChildren"
+ type: "bool"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ }
+ Method { name: "hasChildren"; type: "bool" }
+ Method {
+ name: "data"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QModelIndex" }
+ Parameter { name: "role"; type: "int" }
+ }
+ Method {
+ name: "data"
+ type: "QVariant"
+ Parameter { name: "index"; type: "QModelIndex" }
+ }
+ Method {
+ name: "setData"
+ type: "bool"
+ Parameter { name: "index"; type: "QModelIndex" }
+ Parameter { name: "value"; type: "QVariant" }
+ Parameter { name: "role"; type: "int" }
+ }
+ Method {
+ name: "setData"
+ type: "bool"
+ Parameter { name: "index"; type: "QModelIndex" }
+ Parameter { name: "value"; type: "QVariant" }
+ }
+ Method {
+ name: "headerData"
+ type: "QVariant"
+ Parameter { name: "section"; type: "int" }
+ Parameter { name: "orientation"; type: "Qt::Orientation" }
+ Parameter { name: "role"; type: "int" }
+ }
+ Method {
+ name: "headerData"
+ type: "QVariant"
+ Parameter { name: "section"; type: "int" }
+ Parameter { name: "orientation"; type: "Qt::Orientation" }
+ }
+ Method {
+ name: "fetchMore"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ }
+ Method {
+ name: "canFetchMore"
+ type: "bool"
+ Parameter { name: "parent"; type: "QModelIndex" }
+ }
+ Method {
+ name: "flags"
+ type: "Qt::ItemFlags"
+ Parameter { name: "index"; type: "QModelIndex" }
+ }
+ Method {
+ name: "match"
+ type: "QModelIndexList"
+ Parameter { name: "start"; type: "QModelIndex" }
+ Parameter { name: "role"; type: "int" }
+ Parameter { name: "value"; type: "QVariant" }
+ Parameter { name: "hits"; type: "int" }
+ Parameter { name: "flags"; type: "Qt::MatchFlags" }
+ }
+ Method {
+ name: "match"
+ type: "QModelIndexList"
+ Parameter { name: "start"; type: "QModelIndex" }
+ Parameter { name: "role"; type: "int" }
+ Parameter { name: "value"; type: "QVariant" }
+ Parameter { name: "hits"; type: "int" }
+ }
+ Method {
+ name: "match"
+ type: "QModelIndexList"
+ Parameter { name: "start"; type: "QModelIndex" }
+ Parameter { name: "role"; type: "int" }
+ Parameter { name: "value"; type: "QVariant" }
+ }
+ }
+ Component { name: "QAbstractListModel"; prototype: "QAbstractItemModel" }
Component {
name: "QItemSelectionModel"
prototype: "QObject"
@@ -119,4 +393,203 @@ Module {
}
Method { name: "selectedColumns"; type: "QModelIndexList" }
}
+ Component {
+ name: "QQmlDelegateModel"
+ defaultProperty: "delegate"
+ prototype: "QQmlInstanceModel"
+ exports: ["QtQml.Models/DelegateModel 2.1"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQmlDelegateModelAttached"
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "filterOnGroup"; type: "string" }
+ Property { name: "items"; type: "QQmlDelegateModelGroup"; isReadonly: true; isPointer: true }
+ Property {
+ name: "persistedItems"
+ type: "QQmlDelegateModelGroup"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "groups"; type: "QQmlDelegateModelGroup"; isList: true; isReadonly: true }
+ Property { name: "parts"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property { name: "rootIndex"; type: "QVariant" }
+ Signal { name: "filterGroupChanged" }
+ Signal { name: "defaultGroupsChanged" }
+ Method {
+ name: "modelIndex"
+ type: "QVariant"
+ Parameter { name: "idx"; type: "int" }
+ }
+ Method { name: "parentModelIndex"; type: "QVariant" }
+ }
+ Component {
+ name: "QQmlDelegateModelAttached"
+ prototype: "QObject"
+ Property { name: "model"; type: "QQmlDelegateModel"; isReadonly: true; isPointer: true }
+ Property { name: "groups"; type: "QStringList" }
+ Property { name: "isUnresolved"; type: "bool"; isReadonly: true }
+ Signal { name: "unresolvedChanged" }
+ }
+ Component {
+ name: "QQmlDelegateModelGroup"
+ prototype: "QObject"
+ exports: ["QtQml.Models/DelegateModelGroup 2.1"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "name"; type: "string" }
+ Property { name: "includeByDefault"; type: "bool" }
+ Signal { name: "defaultIncludeChanged" }
+ Signal {
+ name: "changed"
+ Parameter { name: "removed"; type: "QQmlV4Handle" }
+ Parameter { name: "inserted"; type: "QQmlV4Handle" }
+ }
+ Method {
+ name: "insert"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "create"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "resolve"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "remove"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "addGroups"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "removeGroups"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "setGroups"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "move"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "get"
+ type: "QQmlV4Handle"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component { name: "QQmlDelegateModelParts"; prototype: "QObject" }
+ Component {
+ name: "QQmlListElement"
+ prototype: "QObject"
+ exports: ["QtQml.Models/ListElement 2.1"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQmlListModel"
+ prototype: "QAbstractListModel"
+ exports: ["QtQml.Models/ListModel 2.1"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "dynamicRoles"; type: "bool" }
+ Method { name: "clear" }
+ Method {
+ name: "remove"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "append"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "insert"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "get"
+ type: "QQmlV4Handle"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "set"
+ Parameter { name: "index"; type: "int" }
+ Parameter { type: "QQmlV4Handle" }
+ }
+ Method {
+ name: "setProperty"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "property"; type: "string" }
+ Parameter { name: "value"; type: "QVariant" }
+ }
+ Method {
+ name: "move"
+ Parameter { name: "from"; type: "int" }
+ Parameter { name: "to"; type: "int" }
+ Parameter { name: "count"; type: "int" }
+ }
+ Method { name: "sync" }
+ }
+ Component {
+ name: "QQmlObjectModel"
+ defaultProperty: "children"
+ prototype: "QQmlInstanceModel"
+ exports: [
+ "QtQml.Models/ObjectModel 2.1",
+ "QtQml.Models/ObjectModel 2.3"
+ ]
+ exportMetaObjectRevisions: [0, 3]
+ attachedType: "QQmlObjectModelAttached"
+ Property { name: "children"; type: "QObject"; isList: true; isReadonly: true }
+ Method { name: "clear"; revision: 3 }
+ Method {
+ name: "get"
+ revision: 3
+ type: "QObject*"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "append"
+ revision: 3
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "insert"
+ revision: 3
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "move"
+ revision: 3
+ Parameter { name: "from"; type: "int" }
+ Parameter { name: "to"; type: "int" }
+ Parameter { name: "n"; type: "int" }
+ }
+ Method {
+ name: "move"
+ revision: 3
+ Parameter { name: "from"; type: "int" }
+ Parameter { name: "to"; type: "int" }
+ }
+ Method {
+ name: "remove"
+ revision: 3
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "n"; type: "int" }
+ }
+ Method {
+ name: "remove"
+ revision: 3
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQmlObjectModelAttached"
+ prototype: "QObject"
+ Property { name: "index"; type: "int"; isReadonly: true }
+ }
}
diff --git a/src/imports/particles/particles.pro b/src/imports/particles/particles.pro
index 4460d03a04..41146c75b0 100644
--- a/src/imports/particles/particles.pro
+++ b/src/imports/particles/particles.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = particlesplugin
TARGETPATH = QtQuick/Particles.2
-IMPORT_VERSION = 2.0
+IMPORT_VERSION = 2.$$QT_MINOR_VERSION
SOURCES += \
plugin.cpp
diff --git a/src/imports/particles/plugin.cpp b/src/imports/particles/plugin.cpp
index 28ce0f7796..26fd979133 100644
--- a/src/imports/particles/plugin.cpp
+++ b/src/imports/particles/plugin.cpp
@@ -38,16 +38,10 @@
****************************************************************************/
#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
#include <private/qquickparticlesmodule_p.h>
-static void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQuick_Particles_2);
-#endif
-}
-
QT_BEGIN_NAMESPACE
//![class decl]
@@ -56,12 +50,14 @@ class QtQuick2ParticlesPlugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- QtQuick2ParticlesPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
- void registerTypes(const char *uri) Q_DECL_OVERRIDE
+ QtQuick2ParticlesPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
+ void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Particles"));
- Q_UNUSED(uri);
QQuickParticlesModule::defineModule();
+
+ // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward
+ qmlRegisterModule(uri, 2, QT_VERSION_MINOR);
}
};
//![class decl]
diff --git a/src/imports/particles/plugins.qmltypes b/src/imports/particles/plugins.qmltypes
index 6c7c98cc71..b6db00e683 100644
--- a/src/imports/particles/plugins.qmltypes
+++ b/src/imports/particles/plugins.qmltypes
@@ -4,10 +4,10 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtQuick.Particles 2.0'
+// 'qmlplugindump -nonrelocatable QtQuick.Particles 2.13'
Module {
- dependencies: ["QtQuick 2.8"]
+ dependencies: ["QtQuick 2.0"]
Component {
name: "QQuickAgeAffector"
defaultProperty: "data"
diff --git a/src/imports/qtqml/plugins.qmltypes b/src/imports/qtqml/plugins.qmltypes
index 82333627a0..d548a78dd0 100644
--- a/src/imports/qtqml/plugins.qmltypes
+++ b/src/imports/qtqml/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -noforceqtquick QtQml 2.3'
+// 'qmlplugindump -nonrelocatable -noforceqtquick QtQml 2.13'
Module {
dependencies: []
@@ -96,7 +96,7 @@ Module {
exports: ["QtQml/Connections 2.0", "QtQml/Connections 2.3"]
exportMetaObjectRevisions: [0, 1]
Property { name: "target"; type: "QObject"; isPointer: true }
- Property { name: "enabled"; type: "bool" }
+ Property { name: "enabled"; revision: 1; type: "bool" }
Property { name: "ignoreUnknownSignals"; type: "bool" }
Signal { name: "enabledChanged"; revision: 1 }
}
@@ -198,9 +198,20 @@ Module {
Component {
name: "QQmlLoggingCategory"
prototype: "QObject"
- exports: ["QtQml/LoggingCategory 2.8"]
- exportMetaObjectRevisions: [0]
+ exports: ["QtQml/LoggingCategory 2.12", "QtQml/LoggingCategory 2.8"]
+ exportMetaObjectRevisions: [1, 0]
+ Enum {
+ name: "DefaultLogLevel"
+ values: {
+ "Debug": 0,
+ "Info": 4,
+ "Warning": 1,
+ "Critical": 2,
+ "Fatal": 3
+ }
+ }
Property { name: "name"; type: "string" }
+ Property { name: "defaultLogLevel"; revision: 1; type: "DefaultLogLevel" }
}
Component {
name: "QQmlTimer"
@@ -229,5 +240,6 @@ Module {
Property { name: "wasHeld"; type: "bool"; isReadonly: true }
Property { name: "isClick"; type: "bool"; isReadonly: true }
Property { name: "accepted"; type: "bool" }
+ Property { name: "flags"; revision: 11; type: "int"; isReadonly: true }
}
}
diff --git a/src/imports/qtqml/qtqml.pro b/src/imports/qtqml/qtqml.pro
index 05ef15a542..c00172ddc4 100644
--- a/src/imports/qtqml/qtqml.pro
+++ b/src/imports/qtqml/qtqml.pro
@@ -1,5 +1,5 @@
TARGETPATH = QtQml
-QML_FILES += plugins.qmltypes
+AUX_QML_FILES += plugins.qmltypes
load(qml_module)
@@ -7,8 +7,6 @@ load(qml_module)
!cross_compile:if(build_pass|!debug_and_release) {
qtPrepareTool(QMLPLUGINDUMP, qmlplugindump)
- # Use QtQml version defined in qmlplugindump source
- # TODO: retrieve the correct version from QtQml
- qmltypes.commands = $$QMLPLUGINDUMP -nonrelocatable QtQml 2.2 > $$PWD/plugins.qmltypes
+ qmltypes.commands = $$QMLPLUGINDUMP -nonrelocatable -noforceqtquick QtQml 2.$$QT_MINOR_VERSION > $$PWD/plugins.qmltypes
QMAKE_EXTRA_TARGETS += qmltypes
}
diff --git a/src/imports/qtquick2/dependencies.json b/src/imports/qtquick2/dependencies.json
new file mode 100644
index 0000000000..0d4f101c7a
--- /dev/null
+++ b/src/imports/qtquick2/dependencies.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/src/imports/qtquick2/plugin.cpp b/src/imports/qtquick2/plugin.cpp
index d16467a5bb..d73a8b3688 100644
--- a/src/imports/qtquick2/plugin.cpp
+++ b/src/imports/qtquick2/plugin.cpp
@@ -41,13 +41,6 @@
#include <private/qtquick2_p.h>
-static void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQuick_2);
-#endif
-}
-
QT_BEGIN_NAMESPACE
//![class decl]
@@ -56,8 +49,8 @@ class QtQuick2Plugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- QtQuick2Plugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
- void registerTypes(const char *uri) Q_DECL_OVERRIDE
+ QtQuick2Plugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
+ void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick"));
Q_UNUSED(uri);
@@ -65,7 +58,7 @@ public:
QQmlQtQuick2Module::defineModule();
}
- ~QtQuick2Plugin()
+ ~QtQuick2Plugin() override
{
if (moduleDefined)
QQmlQtQuick2Module::undefineModule();
diff --git a/src/imports/qtquick2/plugins.qmltypes b/src/imports/qtquick2/plugins.qmltypes
index 834b4bfac2..f006c874da 100644
--- a/src/imports/qtquick2/plugins.qmltypes
+++ b/src/imports/qtquick2/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -noforceqtquick QtQuick 2.9'
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick 2.13'
Module {
dependencies: []
@@ -19,6 +19,15 @@ Module {
"HorizontalSortHint": 2
}
}
+ Enum {
+ name: "CheckIndexOption"
+ values: {
+ "NoOption": 0,
+ "IndexIsValid": 1,
+ "DoNotUseParent": 2,
+ "ParentIsInvalid": 4
+ }
+ }
Signal {
name: "dataChanged"
Parameter { name: "topLeft"; type: "QModelIndex" }
@@ -733,9 +742,9 @@ Module {
Component {
name: "QQuickAbstractAnimation"
prototype: "QObject"
- exports: ["QtQuick/Animation 2.0"]
+ exports: ["QtQuick/Animation 2.0", "QtQuick/Animation 2.12"]
isCreatable: false
- exportMetaObjectRevisions: [0]
+ exportMetaObjectRevisions: [0, 12]
Enum {
name: "Loops"
values: {
@@ -764,6 +773,7 @@ Module {
name: "loopCountChanged"
Parameter { type: "int" }
}
+ Signal { name: "finished"; revision: 12 }
Method { name: "restart" }
Method { name: "start" }
Method { name: "pause" }
@@ -912,6 +922,21 @@ Module {
Component {
name: "QQuickAnchors"
prototype: "QObject"
+ Enum {
+ name: "Anchors"
+ values: {
+ "InvalidAnchor": 0,
+ "LeftAnchor": 1,
+ "RightAnchor": 2,
+ "TopAnchor": 4,
+ "BottomAnchor": 8,
+ "HCenterAnchor": 16,
+ "VCenterAnchor": 32,
+ "BaselineAnchor": 64,
+ "Horizontal_Mask": 19,
+ "Vertical_Mask": 108
+ }
+ }
Property { name: "left"; type: "QQuickAnchorLine" }
Property { name: "right"; type: "QQuickAnchorLine" }
Property { name: "horizontalCenter"; type: "QQuickAnchorLine" }
@@ -936,21 +961,23 @@ Module {
name: "QQuickAnimatedImage"
defaultProperty: "data"
prototype: "QQuickImage"
- exports: ["QtQuick/AnimatedImage 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: ["QtQuick/AnimatedImage 2.0", "QtQuick/AnimatedImage 2.11"]
+ exportMetaObjectRevisions: [0, 11]
Property { name: "playing"; type: "bool" }
Property { name: "paused"; type: "bool" }
Property { name: "currentFrame"; type: "int" }
Property { name: "frameCount"; type: "int"; isReadonly: true }
+ Property { name: "speed"; revision: 11; type: "double" }
Property { name: "sourceSize"; type: "QSize"; isReadonly: true }
Signal { name: "frameChanged" }
+ Signal { name: "speedChanged"; revision: 11 }
}
Component {
name: "QQuickAnimatedSprite"
defaultProperty: "data"
prototype: "QQuickItem"
- exports: ["QtQuick/AnimatedSprite 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: ["QtQuick/AnimatedSprite 2.0", "QtQuick/AnimatedSprite 2.12"]
+ exportMetaObjectRevisions: [0, 12]
Enum {
name: "LoopParameters"
values: {
@@ -1032,6 +1059,7 @@ Module {
name: "currentFrameChanged"
Parameter { name: "arg"; type: "int" }
}
+ Signal { name: "finished"; revision: 12 }
Method { name: "start" }
Method { name: "stop" }
Method { name: "restart" }
@@ -1206,10 +1234,11 @@ Module {
name: "QQuickBehavior"
defaultProperty: "animation"
prototype: "QObject"
- exports: ["QtQuick/Behavior 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: ["QtQuick/Behavior 2.0", "QtQuick/Behavior 2.13"]
+ exportMetaObjectRevisions: [0, 13]
Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true }
Property { name: "enabled"; type: "bool" }
+ Property { name: "targetValue"; revision: 13; type: "QVariant"; isReadonly: true }
}
Component {
name: "QQuickBorderImage"
@@ -1437,6 +1466,25 @@ Module {
Method { name: "drop"; type: "int" }
}
Component {
+ name: "QQuickDragAxis"
+ prototype: "QObject"
+ exports: ["QtQuick/DragAxis 2.12"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "minimum"; type: "double" }
+ Property { name: "maximum"; type: "double" }
+ Property { name: "enabled"; type: "bool" }
+ }
+ Component {
+ name: "QQuickDragHandler"
+ prototype: "QQuickMultiPointHandler"
+ exports: ["QtQuick/DragHandler 2.12"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "xAxis"; type: "QQuickDragAxis"; isReadonly: true; isPointer: true }
+ Property { name: "yAxis"; type: "QQuickDragAxis"; isReadonly: true; isPointer: true }
+ Property { name: "translation"; type: "QVector2D"; isReadonly: true }
+ }
+ Component {
name: "QQuickDropArea"
defaultProperty: "data"
prototype: "QQuickItem"
@@ -1514,11 +1562,66 @@ Module {
Property { name: "type"; type: "Qt::EnterKeyType" }
}
Component {
+ name: "QQuickEventPoint"
+ prototype: "QObject"
+ exports: ["QtQuick/EventPoint 2.12"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "States"
+ values: {
+ "Pressed": 1,
+ "Updated": 2,
+ "Stationary": 4,
+ "Released": 8
+ }
+ }
+ Enum {
+ name: "GrabTransition"
+ values: {
+ "GrabPassive": 1,
+ "UngrabPassive": 2,
+ "CancelGrabPassive": 3,
+ "OverrideGrabPassive": 4,
+ "GrabExclusive": 16,
+ "UngrabExclusive": 32,
+ "CancelGrabExclusive": 48
+ }
+ }
+ Property { name: "event"; type: "QQuickPointerEvent"; isReadonly: true; isPointer: true }
+ Property { name: "position"; type: "QPointF"; isReadonly: true }
+ Property { name: "scenePosition"; type: "QPointF"; isReadonly: true }
+ Property { name: "scenePressPosition"; type: "QPointF"; isReadonly: true }
+ Property { name: "sceneGrabPosition"; type: "QPointF"; isReadonly: true }
+ Property { name: "state"; type: "State"; isReadonly: true }
+ Property { name: "pointId"; type: "int"; isReadonly: true }
+ Property { name: "timeHeld"; type: "double"; isReadonly: true }
+ Property { name: "velocity"; type: "QVector2D"; isReadonly: true }
+ Property { name: "accepted"; type: "bool" }
+ Property { name: "exclusiveGrabber"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ name: "QQuickEventTouchPoint"
+ prototype: "QQuickEventPoint"
+ exports: ["QtQuick/EventTouchPoint 2.12"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "rotation"; type: "double"; isReadonly: true }
+ Property { name: "pressure"; type: "double"; isReadonly: true }
+ Property { name: "ellipseDiameters"; type: "QSizeF"; isReadonly: true }
+ Property { name: "uniqueId"; type: "QPointingDeviceUniqueId"; isReadonly: true }
+ }
+ Component {
name: "QQuickFlickable"
defaultProperty: "flickableData"
prototype: "QQuickItem"
- exports: ["QtQuick/Flickable 2.0", "QtQuick/Flickable 2.9"]
- exportMetaObjectRevisions: [0, 9]
+ exports: [
+ "QtQuick/Flickable 2.0",
+ "QtQuick/Flickable 2.10",
+ "QtQuick/Flickable 2.12",
+ "QtQuick/Flickable 2.9"
+ ]
+ exportMetaObjectRevisions: [0, 10, 12, 9]
Enum {
name: "BoundsBehavior"
values: {
@@ -1529,6 +1632,12 @@ Module {
}
}
Enum {
+ name: "BoundsMovement"
+ values: {
+ "FollowBoundsBehavior": 1
+ }
+ }
+ Enum {
name: "FlickableDirection"
values: {
"AutoFlickDirection": 0,
@@ -1552,6 +1661,7 @@ Module {
Property { name: "horizontalVelocity"; type: "double"; isReadonly: true }
Property { name: "verticalVelocity"; type: "double"; isReadonly: true }
Property { name: "boundsBehavior"; type: "BoundsBehavior" }
+ Property { name: "boundsMovement"; revision: 10; type: "BoundsMovement" }
Property { name: "rebound"; type: "QQuickTransition"; isPointer: true }
Property { name: "maximumFlickVelocity"; type: "double" }
Property { name: "flickDeceleration"; type: "double" }
@@ -1578,17 +1688,20 @@ Module {
isPointer: true
}
Property { name: "pixelAligned"; type: "bool" }
+ Property { name: "synchronousDrag"; revision: 12; type: "bool" }
Property { name: "horizontalOvershoot"; revision: 9; type: "double"; isReadonly: true }
Property { name: "verticalOvershoot"; revision: 9; type: "double"; isReadonly: true }
Property { name: "flickableData"; type: "QObject"; isList: true; isReadonly: true }
Property { name: "flickableChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
Signal { name: "isAtBoundaryChanged" }
+ Signal { name: "boundsMovementChanged"; revision: 10 }
Signal { name: "movementStarted" }
Signal { name: "movementEnded" }
Signal { name: "flickStarted" }
Signal { name: "flickEnded" }
Signal { name: "dragStarted" }
Signal { name: "dragEnded" }
+ Signal { name: "synchronousDragChanged"; revision: 12 }
Signal { name: "horizontalOvershootChanged"; revision: 9 }
Signal { name: "verticalOvershootChanged"; revision: 9 }
Method {
@@ -1795,11 +1908,16 @@ Module {
Property { name: "letterSpacing"; type: "double" }
Property { name: "wordSpacing"; type: "double" }
Property { name: "hintingPreference"; type: "HintingPreference" }
+ Property { name: "kerning"; type: "bool" }
+ Property { name: "preferShaping"; type: "bool" }
Method { name: "toString"; type: "string" }
}
Component {
name: "QQuickGrabGestureEvent"
prototype: "QObject"
+ exports: ["QtQuick/GestureEvent 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
Property { name: "touchPoints"; type: "QObject"; isList: true; isReadonly: true }
Property { name: "dragThreshold"; type: "double"; isReadonly: true }
Method { name: "grab" }
@@ -1808,9 +1926,17 @@ Module {
name: "QQuickGradient"
defaultProperty: "stops"
prototype: "QObject"
- exports: ["QtQuick/Gradient 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: ["QtQuick/Gradient 2.0", "QtQuick/Gradient 2.12"]
+ exportMetaObjectRevisions: [0, 12]
+ Enum {
+ name: "Orientation"
+ values: {
+ "Vertical": 2,
+ "Horizontal": 1
+ }
+ }
Property { name: "stops"; type: "QQuickGradientStop"; isList: true; isReadonly: true }
+ Property { name: "orientation"; revision: 12; type: "Orientation" }
Signal { name: "updated" }
}
Component {
@@ -1958,9 +2084,10 @@ Module {
exports: [
"QtQuick/GridView 2.0",
"QtQuick/GridView 2.1",
+ "QtQuick/GridView 2.13",
"QtQuick/GridView 2.7"
]
- exportMetaObjectRevisions: [0, 1, 7]
+ exportMetaObjectRevisions: [0, 1, 13, 7]
attachedType: "QQuickGridViewAttached"
Enum {
name: "Flow"
@@ -1989,6 +2116,13 @@ Module {
}
Component { name: "QQuickGridViewAttached"; prototype: "QQuickItemViewAttached" }
Component {
+ name: "QQuickHoverHandler"
+ prototype: "QQuickSinglePointHandler"
+ exports: ["QtQuick/HoverHandler 2.12"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ }
+ Component {
name: "QQuickImage"
defaultProperty: "data"
prototype: "QQuickImageBase"
@@ -2088,8 +2222,6 @@ Module {
prototype: "QQuickItem"
Property { name: "implicitWidth"; type: "double"; isReadonly: true }
Property { name: "implicitHeight"; type: "double"; isReadonly: true }
- Signal { name: "implicitWidthChanged2"; revision: 1 }
- Signal { name: "implicitHeightChanged2"; revision: 1 }
}
Component {
name: "QQuickIntValidator"
@@ -2106,10 +2238,21 @@ Module {
exports: [
"QtQuick/Item 2.0",
"QtQuick/Item 2.1",
+ "QtQuick/Item 2.11",
"QtQuick/Item 2.4",
"QtQuick/Item 2.7"
]
- exportMetaObjectRevisions: [0, 1, 2, 7]
+ exportMetaObjectRevisions: [0, 1, 11, 2, 7]
+ Enum {
+ name: "Flags"
+ values: {
+ "ItemClipsChildrenToShape": 1,
+ "ItemAcceptsInputMethod": 2,
+ "ItemIsFocusScope": 4,
+ "ItemHasContents": 8,
+ "ItemAcceptsDrops": 16
+ }
+ }
Enum {
name: "TransformOrigin"
values: {
@@ -2163,6 +2306,7 @@ Module {
Property { name: "antialiasing"; type: "bool" }
Property { name: "implicitWidth"; type: "double" }
Property { name: "implicitHeight"; type: "double" }
+ Property { name: "containmentMask"; revision: 11; type: "QObject"; isPointer: true }
Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
Signal {
name: "childrenRectChanged"
@@ -2214,6 +2358,7 @@ Module {
revision: 1
Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
}
+ Signal { name: "containmentMaskChanged"; revision: 11 }
Method { name: "update" }
Method {
name: "grabToImage"
@@ -2300,6 +2445,7 @@ Module {
Property { name: "samplerName"; type: "QByteArray" }
Property { name: "effect"; type: "QQmlComponent"; isPointer: true }
Property { name: "textureMirroring"; type: "QQuickShaderEffectSource::TextureMirroring" }
+ Property { name: "samples"; type: "int" }
Signal {
name: "enabledChanged"
Parameter { name: "enabled"; type: "bool" }
@@ -2340,6 +2486,10 @@ Module {
name: "textureMirroringChanged"
Parameter { name: "mirroring"; type: "QQuickShaderEffectSource::TextureMirroring" }
}
+ Signal {
+ name: "samplesChanged"
+ Parameter { name: "count"; type: "int" }
+ }
}
Component {
name: "QQuickItemView"
@@ -2347,11 +2497,12 @@ Module {
prototype: "QQuickFlickable"
exports: [
"QtQuick/ItemView 2.1",
+ "QtQuick/ItemView 2.13",
"QtQuick/ItemView 2.3",
"QtQuick/ItemView 2.7"
]
isCreatable: false
- exportMetaObjectRevisions: [1, 2, 7]
+ exportMetaObjectRevisions: [1, 13, 2, 7]
Enum {
name: "LayoutDirection"
values: {
@@ -2445,6 +2596,12 @@ Module {
Parameter { name: "x"; type: "double" }
Parameter { name: "y"; type: "double" }
}
+ Method {
+ name: "itemAtIndex"
+ revision: 13
+ type: "QQuickItem*"
+ Parameter { name: "index"; type: "int" }
+ }
Method { name: "positionViewAtBeginning" }
Method { name: "positionViewAtEnd" }
Method { name: "forceLayout"; revision: 1 }
@@ -2856,6 +3013,14 @@ Module {
Signal { name: "pressAndHoldIntervalChanged"; revision: 9 }
}
Component {
+ name: "QQuickMultiPointHandler"
+ prototype: "QQuickPointerDeviceHandler"
+ Property { name: "minimumPointCount"; type: "int" }
+ Property { name: "maximumPointCount"; type: "int" }
+ Property { name: "centroid"; type: "QQuickHandlerPoint"; isReadonly: true }
+ Signal { name: "marginChanged" }
+ }
+ Component {
name: "QQuickMultiPointTouchArea"
defaultProperty: "data"
prototype: "QQuickItem"
@@ -2960,6 +3125,12 @@ Module {
"InvertedYFramebufferObject": 2
}
}
+ Enum {
+ name: "PerformanceHints"
+ values: {
+ "FastFBOResizing": 1
+ }
+ }
Property { name: "contentsSize"; type: "QSize" }
Property { name: "fillColor"; type: "QColor" }
Property { name: "contentsScale"; type: "double" }
@@ -3010,6 +3181,19 @@ Module {
Signal { name: "changed" }
}
Component {
+ name: "QQuickPathAngleArc"
+ prototype: "QQuickCurve"
+ exports: ["QtQuick/PathAngleArc 2.11"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "centerX"; type: "double" }
+ Property { name: "centerY"; type: "double" }
+ Property { name: "radiusX"; type: "double" }
+ Property { name: "radiusY"; type: "double" }
+ Property { name: "startAngle"; type: "double" }
+ Property { name: "sweepAngle"; type: "double" }
+ Property { name: "moveToStart"; type: "bool" }
+ }
+ Component {
name: "QQuickPathAnimation"
prototype: "QQuickAbstractAnimation"
exports: ["QtQuick/PathAnimation 2.0"]
@@ -3065,8 +3249,8 @@ Module {
Component {
name: "QQuickPathArc"
prototype: "QQuickCurve"
- exports: ["QtQuick/PathArc 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: ["QtQuick/PathArc 2.0", "QtQuick/PathArc 2.9"]
+ exportMetaObjectRevisions: [0, 2]
Enum {
name: "ArcDirection"
values: {
@@ -3078,6 +3262,8 @@ Module {
Property { name: "radiusY"; type: "double" }
Property { name: "useLargeArc"; type: "bool" }
Property { name: "direction"; type: "ArcDirection" }
+ Property { name: "xAxisRotation"; revision: 2; type: "double" }
+ Signal { name: "xAxisRotationChanged"; revision: 2 }
}
Component {
name: "QQuickPathAttribute"
@@ -3130,6 +3316,12 @@ Module {
exportMetaObjectRevisions: [0]
}
Component {
+ name: "QQuickPathMove"
+ prototype: "QQuickCurve"
+ exports: ["QtQuick/PathMove 2.9"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
name: "QQuickPathPercent"
prototype: "QQuickPathElement"
exports: ["QtQuick/PathPercent 2.0"]
@@ -3157,8 +3349,12 @@ Module {
name: "QQuickPathView"
defaultProperty: "data"
prototype: "QQuickItem"
- exports: ["QtQuick/PathView 2.0", "QtQuick/PathView 2.7"]
- exportMetaObjectRevisions: [0, 7]
+ exports: [
+ "QtQuick/PathView 2.0",
+ "QtQuick/PathView 2.13",
+ "QtQuick/PathView 2.7"
+ ]
+ exportMetaObjectRevisions: [0, 13, 7]
attachedType: "QQuickPathViewAttached"
Enum {
name: "HighlightRangeMode"
@@ -3245,6 +3441,12 @@ Module {
Parameter { name: "x"; type: "double" }
Parameter { name: "y"; type: "double" }
}
+ Method {
+ name: "itemAtIndex"
+ revision: 13
+ type: "QQuickItem*"
+ Parameter { name: "index"; type: "int" }
+ }
}
Component {
name: "QQuickPathViewAttached"
@@ -3346,6 +3548,174 @@ Module {
Property { name: "accepted"; type: "bool" }
}
Component {
+ name: "QQuickPinchHandler"
+ prototype: "QQuickMultiPointHandler"
+ exports: ["QtQuick/PinchHandler 2.12"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "minimumScale"; type: "double" }
+ Property { name: "maximumScale"; type: "double" }
+ Property { name: "minimumRotation"; type: "double" }
+ Property { name: "maximumRotation"; type: "double" }
+ Property { name: "scale"; type: "double"; isReadonly: true }
+ Property { name: "activeScale"; type: "double"; isReadonly: true }
+ Property { name: "rotation"; type: "double"; isReadonly: true }
+ Property { name: "translation"; type: "QVector2D"; isReadonly: true }
+ Property { name: "minimumX"; type: "double" }
+ Property { name: "maximumX"; type: "double" }
+ Property { name: "minimumY"; type: "double" }
+ Property { name: "maximumY"; type: "double" }
+ Property { name: "xAxis"; type: "QQuickDragAxis"; isReadonly: true; isPointer: true }
+ Property { name: "yAxis"; type: "QQuickDragAxis"; isReadonly: true; isPointer: true }
+ Signal { name: "updated" }
+ }
+ Component {
+ name: "QQuickPointHandler"
+ prototype: "QQuickSinglePointHandler"
+ exports: ["QtQuick/PointHandler 2.12"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "translation"; type: "QVector2D"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickPointerDevice"
+ prototype: "QObject"
+ exports: ["QtQuick/PointerDevice 2.12"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "DeviceTypes"
+ values: {
+ "UnknownDevice": 0,
+ "Mouse": 1,
+ "TouchScreen": 2,
+ "TouchPad": 4,
+ "Puck": 8,
+ "Stylus": 16,
+ "Airbrush": 32,
+ "AllDevices": 32767
+ }
+ }
+ Enum {
+ name: "PointerTypes"
+ values: {
+ "GenericPointer": 1,
+ "Finger": 2,
+ "Pen": 4,
+ "Eraser": 8,
+ "Cursor": 16,
+ "AllPointerTypes": 32767
+ }
+ }
+ Enum {
+ name: "Capabilities"
+ values: {
+ "Position": 1,
+ "Area": 2,
+ "Pressure": 4,
+ "Velocity": 8,
+ "MouseEmulation": 64,
+ "Scroll": 256,
+ "Hover": 512,
+ "Rotation": 1024,
+ "XTilt": 2048,
+ "YTilt": 4096
+ }
+ }
+ Property { name: "type"; type: "DeviceType"; isReadonly: true }
+ Property { name: "pointerType"; type: "PointerType"; isReadonly: true }
+ Property { name: "capabilities"; type: "Capabilities"; isReadonly: true }
+ Property { name: "maximumTouchPoints"; type: "int"; isReadonly: true }
+ Property { name: "buttonCount"; type: "int"; isReadonly: true }
+ Property { name: "name"; type: "string"; isReadonly: true }
+ Property { name: "uniqueId"; type: "QPointingDeviceUniqueId"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickPointerDeviceHandler"
+ prototype: "QQuickPointerHandler"
+ Property { name: "acceptedDevices"; type: "QQuickPointerDevice::DeviceTypes" }
+ Property { name: "acceptedPointerTypes"; type: "QQuickPointerDevice::PointerTypes" }
+ Property { name: "acceptedButtons"; type: "Qt::MouseButtons" }
+ Property { name: "acceptedModifiers"; type: "Qt::KeyboardModifiers" }
+ Method {
+ name: "setAcceptedDevices"
+ Parameter { name: "acceptedDevices"; type: "QQuickPointerDevice::DeviceTypes" }
+ }
+ Method {
+ name: "setAcceptedPointerTypes"
+ Parameter { name: "acceptedPointerTypes"; type: "QQuickPointerDevice::PointerTypes" }
+ }
+ Method {
+ name: "setAcceptedButtons"
+ Parameter { name: "buttons"; type: "Qt::MouseButtons" }
+ }
+ Method {
+ name: "setAcceptedModifiers"
+ Parameter { name: "acceptedModifiers"; type: "Qt::KeyboardModifiers" }
+ }
+ }
+ Component {
+ name: "QQuickPointerEvent"
+ prototype: "QObject"
+ exports: ["QtQuick/PointerEvent 2.12"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "device"; type: "QQuickPointerDevice"; isReadonly: true; isPointer: true }
+ Property { name: "modifiers"; type: "Qt::KeyboardModifiers"; isReadonly: true }
+ Property { name: "button"; type: "Qt::MouseButtons"; isReadonly: true }
+ Property { name: "buttons"; type: "Qt::MouseButtons"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickPointerHandler"
+ prototype: "QObject"
+ exports: ["QtQuick/PointerHandler 2.12"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "GrabPermissions"
+ values: {
+ "TakeOverForbidden": 0,
+ "CanTakeOverFromHandlersOfSameType": 1,
+ "CanTakeOverFromHandlersOfDifferentType": 2,
+ "CanTakeOverFromItems": 4,
+ "CanTakeOverFromAnything": 15,
+ "ApprovesTakeOverByHandlersOfSameType": 16,
+ "ApprovesTakeOverByHandlersOfDifferentType": 32,
+ "ApprovesTakeOverByItems": 64,
+ "ApprovesCancellation": 128,
+ "ApprovesTakeOverByAnything": 240
+ }
+ }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "active"; type: "bool"; isReadonly: true }
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "parent"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "grabPermissions"; type: "GrabPermissions" }
+ Property { name: "margin"; type: "double" }
+ Signal {
+ name: "grabChanged"
+ Parameter { name: "transition"; type: "QQuickEventPoint::GrabTransition" }
+ Parameter { name: "point"; type: "QQuickEventPoint"; isPointer: true }
+ }
+ Signal { name: "grabPermissionChanged" }
+ Signal {
+ name: "canceled"
+ Parameter { name: "point"; type: "QQuickEventPoint"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickPointerMouseEvent"
+ prototype: "QQuickSinglePointEvent"
+ exports: ["QtQuick/PointerMouseEvent 2.12"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickPointerTouchEvent"
+ prototype: "QQuickPointerEvent"
+ exports: ["QtQuick/PointerTouchEvent 2.12"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
name: "QQuickPositionerAttached"
prototype: "QObject"
Property { name: "index"; type: "int"; isReadonly: true }
@@ -3391,14 +3761,6 @@ Module {
Parameter { type: "int" }
}
Signal {
- name: "fromChanged"
- Parameter { type: "QVariant" }
- }
- Signal {
- name: "toChanged"
- Parameter { type: "QVariant" }
- }
- Signal {
name: "easingChanged"
Parameter { type: "QEasingCurve" }
}
@@ -3423,7 +3785,7 @@ Module {
exports: ["QtQuick/Rectangle 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "color"; type: "QColor" }
- Property { name: "gradient"; type: "QQuickGradient"; isPointer: true }
+ Property { name: "gradient"; type: "QJSValue" }
Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true }
Property { name: "radius"; type: "double" }
}
@@ -3533,6 +3895,10 @@ Module {
Property { name: "right"; type: "int" }
Property { name: "bottom"; type: "int" }
Signal { name: "borderChanged" }
+ Signal { name: "leftBorderChanged" }
+ Signal { name: "topBorderChanged" }
+ Signal { name: "rightBorderChanged" }
+ Signal { name: "bottomBorderChanged" }
}
Component {
name: "QQuickScriptAction"
@@ -3594,9 +3960,10 @@ Module {
prototype: "QQuickItem"
exports: [
"QtQuick/ShaderEffectSource 2.0",
- "QtQuick/ShaderEffectSource 2.6"
+ "QtQuick/ShaderEffectSource 2.6",
+ "QtQuick/ShaderEffectSource 2.9"
]
- exportMetaObjectRevisions: [0, 1]
+ exportMetaObjectRevisions: [0, 1, 2]
Enum {
name: "WrapMode"
values: {
@@ -3632,6 +3999,7 @@ Module {
Property { name: "mipmap"; type: "bool" }
Property { name: "recursive"; type: "bool" }
Property { name: "textureMirroring"; revision: 1; type: "TextureMirroring" }
+ Property { name: "samples"; revision: 2; type: "int" }
Signal { name: "scheduledUpdateCompleted" }
Method { name: "scheduleUpdate" }
}
@@ -3655,6 +4023,12 @@ Module {
Signal { name: "activated" }
Signal { name: "activatedAmbiguously" }
}
+ Component { name: "QQuickSinglePointEvent"; prototype: "QQuickPointerEvent" }
+ Component {
+ name: "QQuickSinglePointHandler"
+ prototype: "QQuickPointerDeviceHandler"
+ Property { name: "point"; type: "QQuickHandlerPoint"; isReadonly: true }
+ }
Component {
name: "QQuickSmoothedAnimation"
prototype: "QQuickNumberAnimation"
@@ -3963,17 +4337,78 @@ Module {
Signal { name: "paletteChanged" }
}
Component {
+ name: "QQuickTableView"
+ defaultProperty: "flickableData"
+ prototype: "QQuickFlickable"
+ exports: ["QtQuick/TableView 2.12"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickTableViewAttached"
+ Property { name: "rows"; type: "int"; isReadonly: true }
+ Property { name: "columns"; type: "int"; isReadonly: true }
+ Property { name: "rowSpacing"; type: "double" }
+ Property { name: "columnSpacing"; type: "double" }
+ Property { name: "rowHeightProvider"; type: "QJSValue" }
+ Property { name: "columnWidthProvider"; type: "QJSValue" }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "reuseItems"; type: "bool" }
+ Property { name: "contentWidth"; type: "double" }
+ Property { name: "contentHeight"; type: "double" }
+ Method { name: "forceLayout" }
+ }
+ Component {
+ name: "QQuickTableViewAttached"
+ prototype: "QObject"
+ Property { name: "view"; type: "QQuickTableView"; isReadonly: true; isPointer: true }
+ Signal { name: "pooled" }
+ Signal { name: "reused" }
+ }
+ Component {
+ name: "QQuickTapHandler"
+ prototype: "QQuickSinglePointHandler"
+ exports: ["QtQuick/TapHandler 2.12"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "GesturePolicy"
+ values: {
+ "DragThreshold": 0,
+ "WithinBounds": 1,
+ "ReleaseWithinBounds": 2
+ }
+ }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "tapCount"; type: "int"; isReadonly: true }
+ Property { name: "timeHeld"; type: "double"; isReadonly: true }
+ Property { name: "longPressThreshold"; type: "double" }
+ Property { name: "gesturePolicy"; type: "GesturePolicy" }
+ Signal {
+ name: "tapped"
+ Parameter { name: "eventPoint"; type: "QQuickEventPoint"; isPointer: true }
+ }
+ Signal {
+ name: "singleTapped"
+ Parameter { name: "eventPoint"; type: "QQuickEventPoint"; isPointer: true }
+ }
+ Signal {
+ name: "doubleTapped"
+ Parameter { name: "eventPoint"; type: "QQuickEventPoint"; isPointer: true }
+ }
+ Signal { name: "longPressed" }
+ }
+ Component {
name: "QQuickText"
defaultProperty: "data"
prototype: "QQuickImplicitSizeItem"
exports: [
"QtQuick/Text 2.0",
+ "QtQuick/Text 2.10",
+ "QtQuick/Text 2.12",
"QtQuick/Text 2.2",
"QtQuick/Text 2.3",
"QtQuick/Text 2.6",
"QtQuick/Text 2.9"
]
- exportMetaObjectRevisions: [0, 2, 3, 6, 9]
+ exportMetaObjectRevisions: [0, 10, 12, 2, 3, 6, 9]
Enum {
name: "HAlignment"
values: {
@@ -4084,6 +4519,7 @@ Module {
Property { name: "rightPadding"; revision: 6; type: "double" }
Property { name: "bottomPadding"; revision: 6; type: "double" }
Property { name: "fontInfo"; revision: 9; type: "QJSValue"; isReadonly: true }
+ Property { name: "advance"; revision: 10; type: "QSizeF"; isReadonly: true }
Signal {
name: "textChanged"
Parameter { name: "text"; type: "string" }
@@ -4123,6 +4559,14 @@ Module {
}
Signal { name: "contentSizeChanged" }
Signal {
+ name: "contentWidthChanged"
+ Parameter { name: "contentWidth"; type: "double" }
+ }
+ Signal {
+ name: "contentHeightChanged"
+ Parameter { name: "contentHeight"; type: "double" }
+ }
+ Signal {
name: "lineHeightChanged"
Parameter { name: "lineHeight"; type: "double" }
}
@@ -4158,12 +4602,13 @@ Module {
exports: [
"QtQuick/TextEdit 2.0",
"QtQuick/TextEdit 2.1",
+ "QtQuick/TextEdit 2.10",
"QtQuick/TextEdit 2.2",
"QtQuick/TextEdit 2.3",
"QtQuick/TextEdit 2.6",
"QtQuick/TextEdit 2.7"
]
- exportMetaObjectRevisions: [0, 1, 2, 3, 6, 7]
+ exportMetaObjectRevisions: [0, 1, 10, 2, 3, 6, 7]
Enum {
name: "HAlignment"
values: {
@@ -4265,6 +4710,7 @@ Module {
Property { name: "rightPadding"; revision: 6; type: "double" }
Property { name: "bottomPadding"; revision: 6; type: "double" }
Property { name: "preeditText"; revision: 7; type: "string"; isReadonly: true }
+ Property { name: "tabStopDistance"; revision: 10; type: "double" }
Signal { name: "preeditTextChanged"; revision: 7 }
Signal { name: "contentSizeChanged" }
Signal {
@@ -4347,6 +4793,11 @@ Module {
Signal { name: "leftPaddingChanged"; revision: 6 }
Signal { name: "rightPaddingChanged"; revision: 6 }
Signal { name: "bottomPaddingChanged"; revision: 6 }
+ Signal {
+ name: "tabStopDistanceChanged"
+ revision: 10
+ Parameter { name: "distance"; type: "double" }
+ }
Method { name: "selectAll" }
Method { name: "selectWord" }
Method {
diff --git a/src/imports/qtquick2/qtquick2.pro b/src/imports/qtquick2/qtquick2.pro
index 118343588a..744dce4195 100644
--- a/src/imports/qtquick2/qtquick2.pro
+++ b/src/imports/qtquick2/qtquick2.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qtquick2plugin
TARGETPATH = QtQuick.2
-IMPORT_VERSION = 2.6
+IMPORT_VERSION = 2.$$QT_MINOR_VERSION
SOURCES += \
plugin.cpp
diff --git a/src/imports/settings/dependencies.json b/src/imports/settings/dependencies.json
new file mode 100644
index 0000000000..0d4f101c7a
--- /dev/null
+++ b/src/imports/settings/dependencies.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/src/imports/settings/plugin.cpp b/src/imports/settings/plugin.cpp
index c422296446..eb7d5027a4 100644
--- a/src/imports/settings/plugin.cpp
+++ b/src/imports/settings/plugin.cpp
@@ -42,13 +42,6 @@
#include "qqmlsettings_p.h"
-static void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_Qt_labs_settings);
-#endif
-}
-
QT_BEGIN_NAMESPACE
class QmlSettingsPlugin : public QQmlExtensionPlugin
@@ -57,11 +50,12 @@ class QmlSettingsPlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- QmlSettingsPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
- void registerTypes(const char *uri) Q_DECL_OVERRIDE
+ QmlSettingsPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
+ void registerTypes(const char *uri) override
{
Q_ASSERT(QByteArray(uri) == QByteArray("Qt.labs.settings"));
qmlRegisterType<QQmlSettings>(uri, 1, 0, "Settings");
+ qmlRegisterModule(uri, 1, 1); // QTBUG-73239
}
};
diff --git a/src/imports/settings/plugins.qmltypes b/src/imports/settings/plugins.qmltypes
index 40d8746525..bbc5c1cf8f 100644
--- a/src/imports/settings/plugins.qmltypes
+++ b/src/imports/settings/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -noforceqtquick Qt.labs.settings 1.0'
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json Qt.labs.settings 1.1'
Module {
dependencies: []
@@ -14,5 +14,23 @@ Module {
exports: ["Qt.labs.settings/Settings 1.0"]
exportMetaObjectRevisions: [0]
Property { name: "category"; type: "string" }
+ Property { name: "fileName"; type: "string" }
+ Method {
+ name: "value"
+ type: "QVariant"
+ Parameter { name: "key"; type: "string" }
+ Parameter { name: "defaultValue"; type: "QVariant" }
+ }
+ Method {
+ name: "value"
+ type: "QVariant"
+ Parameter { name: "key"; type: "string" }
+ }
+ Method {
+ name: "setValue"
+ Parameter { name: "key"; type: "string" }
+ Parameter { name: "value"; type: "QVariant" }
+ }
+ Method { name: "sync" }
}
}
diff --git a/src/imports/settings/qqmlsettings.cpp b/src/imports/settings/qqmlsettings.cpp
index df67c04654..287a70363a 100644
--- a/src/imports/settings/qqmlsettings.cpp
+++ b/src/imports/settings/qqmlsettings.cpp
@@ -39,9 +39,12 @@
#include "qqmlsettings_p.h"
#include <qcoreevent.h>
+#include <qcoreapplication.h>
+#include <qloggingcategory.h>
#include <qsettings.h>
#include <qpointer.h>
#include <qjsvalue.h>
+#include <qqmlinfo.h>
#include <qdebug.h>
#include <qhash.h>
@@ -155,7 +158,8 @@ QT_BEGIN_NAMESPACE
Application specific settings are identified by providing application
\l {QCoreApplication::applicationName}{name},
\l {QCoreApplication::organizationName}{organization} and
- \l {QCoreApplication::organizationDomain}{domain}.
+ \l {QCoreApplication::organizationDomain}{domain}, or by specifying
+ \l fileName.
\code
#include <QGuiApplication>
@@ -188,6 +192,9 @@ QT_BEGIN_NAMESPACE
only provides a cleaner settings structure, but also prevents possible
conflicts between setting keys.
+ If several categories are required, use several Settings objects, each with
+ their own category:
+
\qml
Item {
id: panel
@@ -199,6 +206,12 @@ QT_BEGIN_NAMESPACE
property alias visible: panel.visible
// ...
}
+
+ Settings {
+ category: "General"
+ property alias fontSize: fontSizeSpinBox.value
+ // ...
+ }
}
\endqml
@@ -222,7 +235,7 @@ QT_BEGIN_NAMESPACE
\sa QSettings
*/
-// #define SETTINGS_DEBUG
+Q_LOGGING_CATEGORY(lcSettings, "qt.labs.settings")
static const int settingsWriteDelay = 500;
@@ -244,24 +257,42 @@ public:
void _q_propertyChanged();
QVariant readProperty(const QMetaProperty &property) const;
- QQmlSettings *q_ptr;
- int timerId;
- bool initialized;
+ QQmlSettings *q_ptr = nullptr;
+ int timerId = 0;
+ bool initialized = false;
QString category;
+ QString fileName;
mutable QPointer<QSettings> settings;
QHash<const char *, QVariant> changedProperties;
};
-QQmlSettingsPrivate::QQmlSettingsPrivate()
- : q_ptr(0), timerId(0), initialized(false)
-{
-}
+QQmlSettingsPrivate::QQmlSettingsPrivate() {}
QSettings *QQmlSettingsPrivate::instance() const
{
if (!settings) {
QQmlSettings *q = const_cast<QQmlSettings*>(q_func());
- settings = new QSettings(q);
+ settings = fileName.isEmpty() ? new QSettings(q) : new QSettings(fileName, QSettings::IniFormat, q);
+ if (settings->status() != QSettings::NoError) {
+ // TODO: can't print out the enum due to the following error:
+ // error: C2666: 'QQmlInfo::operator <<': 15 overloads have similar conversions
+ qmlWarning(q) << "Failed to initialize QSettings instance. Status code is: " << int(settings->status());
+
+ if (settings->status() == QSettings::AccessError) {
+ QVector<QString> missingIdentifiers;
+ if (QCoreApplication::organizationName().isEmpty())
+ missingIdentifiers.append(QLatin1String("organizationName"));
+ if (QCoreApplication::organizationDomain().isEmpty())
+ missingIdentifiers.append(QLatin1String("organizationDomain"));
+ if (QCoreApplication::applicationName().isEmpty())
+ missingIdentifiers.append(QLatin1String("applicationName"));
+
+ if (!missingIdentifiers.isEmpty())
+ qmlWarning(q) << "The following application identifiers have not been set: " << missingIdentifiers;
+ }
+ return settings;
+ }
+
if (!category.isEmpty())
settings->beginGroup(category);
if (initialized)
@@ -273,9 +304,7 @@ QSettings *QQmlSettingsPrivate::instance() const
void QQmlSettingsPrivate::init()
{
if (!initialized) {
-#ifdef SETTINGS_DEBUG
- qDebug() << "QQmlSettings: stored at" << instance()->fileName();
-#endif
+ qCDebug(lcSettings) << "QQmlSettings: stored at" << instance()->fileName();
load();
initialized = true;
}
@@ -294,6 +323,11 @@ void QQmlSettingsPrivate::load()
const QMetaObject *mo = q->metaObject();
const int offset = mo->propertyOffset();
const int count = mo->propertyCount();
+
+ // don't save built-in properties if there aren't any qml properties
+ if (offset == 1)
+ return;
+
for (int i = offset; i < count; ++i) {
QMetaProperty property = mo->property(i);
@@ -303,9 +337,7 @@ void QQmlSettingsPrivate::load()
if (!currentValue.isNull() && (!previousValue.isValid()
|| (currentValue.canConvert(previousValue.type()) && previousValue != currentValue))) {
property.write(q, currentValue);
-#ifdef SETTINGS_DEBUG
- qDebug() << "QQmlSettings: load" << property.name() << "setting:" << currentValue << "default:" << previousValue;
-#endif
+ qCDebug(lcSettings) << "QQmlSettings: load" << property.name() << "setting:" << currentValue << "default:" << previousValue;
}
// ensure that a non-existent setting gets written
@@ -326,9 +358,7 @@ void QQmlSettingsPrivate::store()
QHash<const char *, QVariant>::const_iterator it = changedProperties.constBegin();
while (it != changedProperties.constEnd()) {
instance()->setValue(it.key(), it.value());
-#ifdef SETTINGS_DEBUG
- qDebug() << "QQmlSettings: store" << it.key() << ":" << it.value();
-#endif
+ qCDebug(lcSettings) << "QQmlSettings: store" << it.key() << ":" << it.value();
++it;
}
changedProperties.clear();
@@ -344,9 +374,7 @@ void QQmlSettingsPrivate::_q_propertyChanged()
const QMetaProperty &property = mo->property(i);
const QVariant value = readProperty(property);
changedProperties.insert(property.name(), value);
-#ifdef SETTINGS_DEBUG
- qDebug() << "QQmlSettings: cache" << property.name() << ":" << value;
-#endif
+ qCDebug(lcSettings) << "QQmlSettings: cache" << property.name() << ":" << value;
}
if (timerId != 0)
q->killTimer(timerId);
@@ -399,6 +427,85 @@ void QQmlSettings::setCategory(const QString &category)
}
}
+/*!
+ \qmlproperty string Settings::fileName
+
+ This property holds the path to the settings file. If the file doesn't
+ already exist, it is created.
+
+ \since Qt 5.12
+
+ \sa QSettings::fileName, QSettings::IniFormat
+*/
+QString QQmlSettings::fileName() const
+{
+ Q_D(const QQmlSettings);
+ return d->fileName;
+}
+
+void QQmlSettings::setFileName(const QString &fileName)
+{
+ Q_D(QQmlSettings);
+ if (d->fileName != fileName) {
+ d->reset();
+ d->fileName = fileName;
+ if (d->initialized)
+ d->load();
+ }
+}
+
+/*!
+ \qmlmethod var Settings::value(string key, var defaultValue)
+
+ Returns the value for setting \a key. If the setting doesn't exist,
+ returns \a defaultValue.
+
+ \since Qt 5.12
+
+ \sa QSettings::value
+*/
+QVariant QQmlSettings::value(const QString &key, const QVariant &defaultValue) const
+{
+ Q_D(const QQmlSettings);
+ return d->instance()->value(key, defaultValue);
+}
+
+/*!
+ \qmlmethod Settings::setValue(string key, var value)
+
+ Sets the value of setting key to value. If the key already exists,
+ the previous value is overwritten.
+
+ \since Qt 5.12
+
+ \sa QSettings::setValue
+*/
+void QQmlSettings::setValue(const QString &key, const QVariant &value)
+{
+ Q_D(const QQmlSettings);
+ d->instance()->setValue(key, value);
+ qCDebug(lcSettings) << "QQmlSettings: setValue" << key << ":" << value;
+}
+
+/*!
+ \qmlmethod Settings::sync()
+
+ Writes any unsaved changes to permanent storage, and reloads any
+ settings that have been changed in the meantime by another
+ application.
+
+ This function is called automatically from QSettings's destructor and
+ by the event loop at regular intervals, so you normally don't need to
+ call it yourself.
+
+ \sa QSettings::sync
+*/
+void QQmlSettings::sync()
+{
+ Q_D(QQmlSettings);
+ d->instance()->sync();
+}
+
void QQmlSettings::classBegin()
{
}
diff --git a/src/imports/settings/qqmlsettings_p.h b/src/imports/settings/qqmlsettings_p.h
index ce942d7564..a86c8b4751 100644
--- a/src/imports/settings/qqmlsettings_p.h
+++ b/src/imports/settings/qqmlsettings_p.h
@@ -65,6 +65,7 @@ class QQmlSettings : public QObject, public QQmlParserStatus
Q_OBJECT
Q_INTERFACES(QQmlParserStatus)
Q_PROPERTY(QString category READ category WRITE setCategory FINAL)
+ Q_PROPERTY(QString fileName READ fileName WRITE setFileName FINAL)
public:
explicit QQmlSettings(QObject *parent = 0);
@@ -73,6 +74,13 @@ public:
QString category() const;
void setCategory(const QString &category);
+ QString fileName() const;
+ void setFileName(const QString &fileName);
+
+ Q_INVOKABLE QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const;
+ Q_INVOKABLE void setValue(const QString &key, const QVariant &value);
+ Q_INVOKABLE void sync();
+
protected:
void timerEvent(QTimerEvent *event) override;
diff --git a/src/imports/settings/settings.pro b/src/imports/settings/settings.pro
index 29229f59cb..816a6a9fef 100644
--- a/src/imports/settings/settings.pro
+++ b/src/imports/settings/settings.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qmlsettingsplugin
TARGETPATH = Qt/labs/settings
-IMPORT_VERSION = 1.0
+IMPORT_VERSION = 1.1
QT = core qml
diff --git a/src/imports/shapes/plugin.cpp b/src/imports/shapes/plugin.cpp
index ae0d02da93..e3a9017681 100644
--- a/src/imports/shapes/plugin.cpp
+++ b/src/imports/shapes/plugin.cpp
@@ -39,15 +39,7 @@
#include <QtQml/qqmlextensionplugin.h>
#include <QtQml/qqml.h>
-
-#include "qquickshape_p.h"
-
-static void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQuick_Shapes);
-#endif
-}
+#include <QtQuickShapes/private/qquickshape_p.h>
QT_BEGIN_NAMESPACE
@@ -57,14 +49,26 @@ class QmlShapesPlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- QmlShapesPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
- void registerTypes(const char *uri) Q_DECL_OVERRIDE
+ QmlShapesPlugin(QObject *parent = nullptr)
+ : QQmlExtensionPlugin(parent)
+ {
+ }
+
+ void registerTypes(const char *uri) override
{
Q_ASSERT(QByteArray(uri) == QByteArray("QtQuick.Shapes"));
qmlRegisterType<QQuickShape>(uri, 1, 0, "Shape");
qmlRegisterType<QQuickShapePath>(uri, 1, 0, "ShapePath");
qmlRegisterUncreatableType<QQuickShapeGradient>(uri, 1, 0, "ShapeGradient", QQuickShapeGradient::tr("ShapeGradient is an abstract base class"));
qmlRegisterType<QQuickShapeLinearGradient>(uri, 1, 0, "LinearGradient");
+ qmlRegisterType<QQuickShapeRadialGradient>(uri, 1, 0, "RadialGradient");
+ qmlRegisterType<QQuickShapeConicalGradient>(uri, 1, 0, "ConicalGradient");
+
+ // Auto-increment the import to stay in sync with ALL future QtQuick minor versions
+ qmlRegisterModule(uri, 1, QT_VERSION_MINOR);
+
+ // revision in Qt 5.11: added containsMode property
+ qmlRegisterType<QQuickShape, 11>(uri, 1, 11, "Shape");
}
};
diff --git a/src/imports/shapes/plugins.qmltypes b/src/imports/shapes/plugins.qmltypes
index 00d0050085..b78c5a1130 100644
--- a/src/imports/shapes/plugins.qmltypes
+++ b/src/imports/shapes/plugins.qmltypes
@@ -4,178 +4,63 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -noforceqtquick QtQuick.Shapes 1.0'
+// 'qmlplugindump -nonrelocatable QtQuick.Shapes 1.13'
Module {
- dependencies: []
+ dependencies: ["QtQuick 2.0"]
Component {
- name: "QQuickItem"
+ name: "QQuickShape"
defaultProperty: "data"
- prototype: "QObject"
+ prototype: "QQuickItem"
+ exports: ["QtQuick.Shapes/Shape 1.0", "QtQuick.Shapes/Shape 1.11"]
+ exportMetaObjectRevisions: [0, 11]
Enum {
- name: "TransformOrigin"
+ name: "RendererType"
values: {
- "TopLeft": 0,
- "Top": 1,
- "TopRight": 2,
- "Left": 3,
- "Center": 4,
- "Right": 5,
- "BottomLeft": 6,
- "Bottom": 7,
- "BottomRight": 8
+ "UnknownRenderer": 0,
+ "GeometryRenderer": 1,
+ "NvprRenderer": 2,
+ "SoftwareRenderer": 3
}
}
- Property { name: "parent"; type: "QQuickItem"; isPointer: true }
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
- Property { name: "x"; type: "double" }
- Property { name: "y"; type: "double" }
- Property { name: "z"; type: "double" }
- Property { name: "width"; type: "double" }
- Property { name: "height"; type: "double" }
- Property { name: "opacity"; type: "double" }
- Property { name: "enabled"; type: "bool" }
- Property { name: "visible"; type: "bool" }
- Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
- Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
- Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
- Property { name: "state"; type: "string" }
- Property { name: "childrenRect"; type: "QRectF"; isReadonly: true }
- Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true }
- Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true }
- Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true }
- Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
- Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true }
- Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true }
- Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
- Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true }
- Property { name: "baselineOffset"; type: "double" }
- Property { name: "clip"; type: "bool" }
- Property { name: "focus"; type: "bool" }
- Property { name: "activeFocus"; type: "bool"; isReadonly: true }
- Property { name: "activeFocusOnTab"; revision: 1; type: "bool" }
- Property { name: "rotation"; type: "double" }
- Property { name: "scale"; type: "double" }
- Property { name: "transformOrigin"; type: "TransformOrigin" }
- Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true }
- Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true }
- Property { name: "smooth"; type: "bool" }
- Property { name: "antialiasing"; type: "bool" }
- Property { name: "implicitWidth"; type: "double" }
- Property { name: "implicitHeight"; type: "double" }
- Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
- Signal {
- name: "childrenRectChanged"
- Parameter { type: "QRectF" }
- }
- Signal {
- name: "baselineOffsetChanged"
- Parameter { type: "double" }
- }
- Signal {
- name: "stateChanged"
- Parameter { type: "string" }
- }
- Signal {
- name: "focusChanged"
- Parameter { type: "bool" }
- }
- Signal {
- name: "activeFocusChanged"
- Parameter { type: "bool" }
- }
- Signal {
- name: "activeFocusOnTabChanged"
- revision: 1
- Parameter { type: "bool" }
- }
- Signal {
- name: "parentChanged"
- Parameter { type: "QQuickItem"; isPointer: true }
- }
- Signal {
- name: "transformOriginChanged"
- Parameter { type: "TransformOrigin" }
- }
- Signal {
- name: "smoothChanged"
- Parameter { type: "bool" }
- }
- Signal {
- name: "antialiasingChanged"
- Parameter { type: "bool" }
- }
- Signal {
- name: "clipChanged"
- Parameter { type: "bool" }
- }
- Signal {
- name: "windowChanged"
- revision: 1
- Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
- }
- Method { name: "update" }
- Method {
- name: "grabToImage"
- revision: 2
- type: "bool"
- Parameter { name: "callback"; type: "QJSValue" }
- Parameter { name: "targetSize"; type: "QSize" }
- }
- Method {
- name: "grabToImage"
- revision: 2
- type: "bool"
- Parameter { name: "callback"; type: "QJSValue" }
- }
- Method {
- name: "contains"
- type: "bool"
- Parameter { name: "point"; type: "QPointF" }
- }
- Method {
- name: "mapFromItem"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "mapToItem"
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "mapFromGlobal"
- revision: 7
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "mapToGlobal"
- revision: 7
- Parameter { type: "QQmlV4Function"; isPointer: true }
- }
- Method { name: "forceActiveFocus" }
- Method {
- name: "forceActiveFocus"
- Parameter { name: "reason"; type: "Qt::FocusReason" }
- }
- Method {
- name: "nextItemInFocusChain"
- revision: 1
- type: "QQuickItem*"
- Parameter { name: "forward"; type: "bool" }
+ Enum {
+ name: "Status"
+ values: {
+ "Null": 0,
+ "Ready": 1,
+ "Processing": 2
+ }
}
- Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" }
- Method {
- name: "childAt"
- type: "QQuickItem*"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
+ Enum {
+ name: "ContainsMode"
+ values: {
+ "BoundingRectContains": 0,
+ "FillContains": 1
+ }
}
+ Property { name: "rendererType"; type: "RendererType"; isReadonly: true }
+ Property { name: "asynchronous"; type: "bool" }
+ Property { name: "vendorExtensionsEnabled"; type: "bool" }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ Property { name: "containsMode"; revision: 11; type: "ContainsMode" }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Signal { name: "rendererChanged" }
+ Signal { name: "containsModeChanged"; revision: 11 }
+ }
+ Component {
+ name: "QQuickShapeConicalGradient"
+ defaultProperty: "stops"
+ prototype: "QQuickShapeGradient"
+ exports: ["QtQuick.Shapes/ConicalGradient 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "centerX"; type: "double" }
+ Property { name: "centerY"; type: "double" }
+ Property { name: "angle"; type: "double" }
}
Component {
name: "QQuickShapeGradient"
defaultProperty: "stops"
- prototype: "QObject"
+ prototype: "QQuickGradient"
exports: ["QtQuick.Shapes/ShapeGradient 1.0"]
isCreatable: false
exportMetaObjectRevisions: [0]
@@ -187,38 +72,7 @@ Module {
"ReflectSpread": 2
}
}
- Property { name: "stops"; type: "QObject"; isList: true; isReadonly: true }
Property { name: "spread"; type: "SpreadMode" }
- Signal { name: "updated" }
- }
- Component {
- name: "QQuickShape"
- defaultProperty: "elements"
- prototype: "QQuickItem"
- exports: ["QtQuick.Shapes/Shape 1.0"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "RendererType"
- values: {
- "UnknownRenderer": 0,
- "GeometryRenderer": 1,
- "NvprRenderer": 2,
- "SoftwareRenderer": 3
- }
- }
- Enum {
- name: "Status"
- values: {
- "Null": 0,
- "Ready": 1,
- "Processing": 2
- }
- }
- Property { name: "renderer"; type: "RendererType"; isReadonly: true }
- Property { name: "asynchronous"; type: "bool" }
- Property { name: "enableVendorExtensions"; type: "bool" }
- Property { name: "status"; type: "Status"; isReadonly: true }
- Property { name: "elements"; type: "QQuickShapePath"; isList: true; isReadonly: true }
}
Component {
name: "QQuickShapeLinearGradient"
@@ -233,8 +87,8 @@ Module {
}
Component {
name: "QQuickShapePath"
- defaultProperty: "path"
- prototype: "QObject"
+ defaultProperty: "pathElements"
+ prototype: "QQuickPath"
exports: ["QtQuick.Shapes/ShapePath 1.0"]
exportMetaObjectRevisions: [0]
Enum {
@@ -267,7 +121,6 @@ Module {
"DashLine": 2
}
}
- Property { name: "path"; type: "QQuickPath"; isPointer: true }
Property { name: "strokeColor"; type: "QColor" }
Property { name: "strokeWidth"; type: "double" }
Property { name: "fillColor"; type: "QColor" }
@@ -279,6 +132,19 @@ Module {
Property { name: "dashOffset"; type: "double" }
Property { name: "dashPattern"; type: "QVector<qreal>" }
Property { name: "fillGradient"; type: "QQuickShapeGradient"; isPointer: true }
- Signal { name: "changed" }
+ Signal { name: "shapePathChanged" }
+ }
+ Component {
+ name: "QQuickShapeRadialGradient"
+ defaultProperty: "stops"
+ prototype: "QQuickShapeGradient"
+ exports: ["QtQuick.Shapes/RadialGradient 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "centerX"; type: "double" }
+ Property { name: "centerY"; type: "double" }
+ Property { name: "centerRadius"; type: "double" }
+ Property { name: "focalX"; type: "double" }
+ Property { name: "focalY"; type: "double" }
+ Property { name: "focalRadius"; type: "double" }
}
}
diff --git a/src/imports/shapes/qquicknvprfunctions.cpp b/src/imports/shapes/qquicknvprfunctions.cpp
deleted file mode 100644
index e9b93cf4a1..0000000000
--- a/src/imports/shapes/qquicknvprfunctions.cpp
+++ /dev/null
@@ -1,277 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qquicknvprfunctions_p.h"
-
-#ifndef QT_NO_OPENGL
-
-#include <QOpenGLContext>
-#include <QOffscreenSurface>
-#include <QOpenGLExtraFunctions>
-#include "qquicknvprfunctions_p_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QQuickNvprFunctions
-
- \brief Function resolvers and other helpers for GL_NV_path_rendering
- for both desktop (GL 4.3+) and mobile/embedded (GLES 3.1+) in a manner
- that does not distract builds that do not have NVPR support either at
- compile or run time.
-
- \internal
- */
-
-QQuickNvprFunctions::QQuickNvprFunctions()
- : d(new QQuickNvprFunctionsPrivate(this))
-{
-}
-
-QQuickNvprFunctions::~QQuickNvprFunctions()
-{
- delete d;
-}
-
-/*!
- \return a recommended QSurfaceFormat suitable for GL_NV_path_rendering on top
- of OpenGL 4.3 or OpenGL ES 3.1.
- */
-QSurfaceFormat QQuickNvprFunctions::format()
-{
- QSurfaceFormat fmt;
- fmt.setDepthBufferSize(24);
- fmt.setStencilBufferSize(8);
- if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
- fmt.setVersion(4, 3);
- fmt.setProfile(QSurfaceFormat::CompatibilityProfile);
- } else if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) {
- fmt.setVersion(3, 1);
- }
- return fmt;
-}
-
-/*!
- \return true if GL_NV_path_rendering is supported with the current OpenGL
- context.
-
- When there is no current context, a temporary dummy one will be created and
- made current.
- */
-bool QQuickNvprFunctions::isSupported()
-{
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- QScopedPointer<QOpenGLContext> tempContext;
- QScopedPointer<QOffscreenSurface> tempSurface;
- if (!ctx) {
- tempContext.reset(new QOpenGLContext);
- if (!tempContext->create())
- return false;
- ctx = tempContext.data();
- tempSurface.reset(new QOffscreenSurface);
- tempSurface->setFormat(ctx->format());
- tempSurface->create();
- if (!ctx->makeCurrent(tempSurface.data()))
- return false;
- }
-
- if (!ctx->hasExtension(QByteArrayLiteral("GL_NV_path_rendering")))
- return false;
-
- // Do not check for DSA as the string may not be exposed on ES
- // drivers, yet the functions we need are resolvable.
-#if 0
- if (!ctx->hasExtension(QByteArrayLiteral("GL_EXT_direct_state_access"))) {
- qWarning("QtQuickPath/NVPR: GL_EXT_direct_state_access not supported");
- return false;
- }
-#endif
-
- return true;
-}
-
-/*!
- Initializes using the current OpenGL context.
-
- \return true when GL_NV_path_rendering is supported and initialization was
- successful.
- */
-bool QQuickNvprFunctions::create()
-{
- return isSupported() && d->resolve();
-}
-
-/*!
- Creates a program pipeline consisting of a separable fragment shader program.
-
- This is essential for using NVPR with OpenGL ES 3.1+ since normal,
- GLES2-style programs would not work without a vertex shader.
-
- \note \a fragmentShaderSource should be a \c{version 310 es} shader since
- this works both on desktop and embedded NVIDIA drivers, thus avoiding the
- need to fight GLSL and GLSL ES differences.
-
- The pipeline object is stored into \a pipeline, the fragment shader program
- into \a program.
-
- Use QOpenGLExtraFunctions to set uniforms, bind the pipeline, etc.
-
- \return \c false on failure in which case the error log is printed on the
- debug output. \c true on success.
- */
-bool QQuickNvprFunctions::createFragmentOnlyPipeline(const char *fragmentShaderSource, GLuint *pipeline, GLuint *program)
-{
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (!ctx)
- return false;
-
- QOpenGLExtraFunctions *f = ctx->extraFunctions();
- *program = f->glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1, &fragmentShaderSource);
- GLint status = 0;
- f->glGetProgramiv(*program, GL_LINK_STATUS, &status);
- if (!status) {
- GLint len = 0;
- f->glGetProgramiv(*program, GL_INFO_LOG_LENGTH, &len);
- if (len) {
- QByteArray s;
- s.resize(len);
- f->glGetProgramInfoLog(*program, s.count(), nullptr, s.data());
- qWarning("Failed to create separable shader program:\n%s", s.constData());
- }
- return false;
- }
-
- f->glGenProgramPipelines(1, pipeline);
- f->glUseProgramStages(*pipeline, GL_FRAGMENT_SHADER_BIT, *program);
- f->glActiveShaderProgram(*pipeline, *program);
-
- f->glValidateProgramPipeline(*pipeline);
- status = 0;
- f->glGetProgramPipelineiv(*pipeline, GL_VALIDATE_STATUS, &status);
- if (!status) {
- GLint len = 0;
- f->glGetProgramPipelineiv(*pipeline, GL_INFO_LOG_LENGTH, &len);
- if (len) {
- QByteArray s;
- s.resize(len);
- f->glGetProgramPipelineInfoLog(*pipeline, s.count(), nullptr, s.data());
- qWarning("Program pipeline validation failed:\n%s", s.constData());
- }
- return false;
- }
-
- return true;
-}
-
-#define PROC(type, name) reinterpret_cast<type>(ctx->getProcAddress(#name))
-
-bool QQuickNvprFunctionsPrivate::resolve()
-{
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
-
- q->genPaths = PROC(PFNGLGENPATHSNVPROC, glGenPathsNV);
- q->deletePaths = PROC(PFNGLDELETEPATHSNVPROC, glDeletePathsNV);
- q->isPath = PROC(PFNGLISPATHNVPROC, glIsPathNV);
- q->pathCommands = PROC(PFNGLPATHCOMMANDSNVPROC, glPathCommandsNV);
- q->pathCoords = PROC(PFNGLPATHCOORDSNVPROC, glPathCoordsNV);
- q->pathSubCommands = PROC(PFNGLPATHSUBCOMMANDSNVPROC, glPathSubCommandsNV);
- q->pathSubCoords = PROC(PFNGLPATHSUBCOORDSNVPROC, glPathSubCoordsNV);
- q->pathString = PROC(PFNGLPATHSTRINGNVPROC, glPathStringNV);
- q->pathGlyphs = PROC(PFNGLPATHGLYPHSNVPROC, glPathGlyphsNV);
- q->pathGlyphRange = PROC(PFNGLPATHGLYPHRANGENVPROC, glPathGlyphRangeNV);
- q->weightPaths = PROC(PFNGLWEIGHTPATHSNVPROC, glWeightPathsNV);
- q->copyPath = PROC(PFNGLCOPYPATHNVPROC, glCopyPathNV);
- q->interpolatePaths = PROC(PFNGLINTERPOLATEPATHSNVPROC, glInterpolatePathsNV);
- q->transformPath = PROC(PFNGLTRANSFORMPATHNVPROC, glTransformPathNV);
- q->pathParameteriv = PROC(PFNGLPATHPARAMETERIVNVPROC, glPathParameterivNV);
- q->pathParameteri = PROC(PFNGLPATHPARAMETERINVPROC, glPathParameteriNV);
- q->pathParameterfv = PROC(PFNGLPATHPARAMETERFVNVPROC, glPathParameterfvNV);
- q->pathParameterf = PROC(PFNGLPATHPARAMETERFNVPROC, glPathParameterfNV);
- q->pathDashArray = PROC(PFNGLPATHDASHARRAYNVPROC, glPathDashArrayNV);
- q->pathStencilFunc = PROC(PFNGLPATHSTENCILFUNCNVPROC, glPathStencilFuncNV);
- q->pathStencilDepthOffset = PROC(PFNGLPATHSTENCILDEPTHOFFSETNVPROC, glPathStencilDepthOffsetNV);
- q->stencilFillPath = PROC(PFNGLSTENCILFILLPATHNVPROC, glStencilFillPathNV);
- q->stencilStrokePath = PROC(PFNGLSTENCILSTROKEPATHNVPROC, glStencilStrokePathNV);
- q->stencilFillPathInstanced = PROC(PFNGLSTENCILFILLPATHINSTANCEDNVPROC, glStencilFillPathInstancedNV);
- q->stencilStrokePathInstanced = PROC(PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC, glStencilStrokePathInstancedNV);
- q->pathCoverDepthFunc = PROC(PFNGLPATHCOVERDEPTHFUNCNVPROC, glPathCoverDepthFuncNV);
- q->coverFillPath = PROC(PFNGLCOVERFILLPATHNVPROC, glCoverFillPathNV);
- q->coverStrokePath = PROC(PFNGLCOVERSTROKEPATHNVPROC, glCoverStrokePathNV);
- q->coverFillPathInstanced = PROC(PFNGLCOVERFILLPATHINSTANCEDNVPROC, glCoverFillPathInstancedNV);
- q->coverStrokePathInstanced = PROC(PFNGLCOVERSTROKEPATHINSTANCEDNVPROC, glCoverStrokePathInstancedNV);
- q->getPathParameteriv = PROC(PFNGLGETPATHPARAMETERIVNVPROC, glGetPathParameterivNV);
- q->getPathParameterfv = PROC(PFNGLGETPATHPARAMETERFVNVPROC, glGetPathParameterfvNV);
- q->getPathCommands = PROC(PFNGLGETPATHCOMMANDSNVPROC, glGetPathCommandsNV);
- q->getPathCoords = PROC(PFNGLGETPATHCOORDSNVPROC, glGetPathCoordsNV);
- q->getPathDashArray = PROC(PFNGLGETPATHDASHARRAYNVPROC, glGetPathDashArrayNV);
- q->getPathMetrics = PROC(PFNGLGETPATHMETRICSNVPROC, glGetPathMetricsNV);
- q->getPathMetricRange = PROC(PFNGLGETPATHMETRICRANGENVPROC, glGetPathMetricRangeNV);
- q->getPathSpacing = PROC(PFNGLGETPATHSPACINGNVPROC, glGetPathSpacingNV);
- q->isPointInFillPath = PROC(PFNGLISPOINTINFILLPATHNVPROC, glIsPointInFillPathNV);
- q->isPointInStrokePath = PROC(PFNGLISPOINTINSTROKEPATHNVPROC, glIsPointInStrokePathNV);
- q->getPathLength = PROC(PFNGLGETPATHLENGTHNVPROC, glGetPathLengthNV);
- q->getPointAlongPath = PROC(PFNGLPOINTALONGPATHNVPROC, glPointAlongPathNV);
- q->matrixLoad3x2f = PROC(PFNGLMATRIXLOAD3X2FNVPROC, glMatrixLoad3x2fNV);
- q->matrixLoad3x3f = PROC(PFNGLMATRIXLOAD3X3FNVPROC, glMatrixLoad3x3fNV);
- q->matrixLoadTranspose3x3f = PROC(PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC, glMatrixLoadTranspose3x3fNV);
- q->matrixMult3x2f = PROC(PFNGLMATRIXMULT3X2FNVPROC, glMatrixMult3x2fNV);
- q->matrixMult3x3f = PROC(PFNGLMATRIXMULT3X3FNVPROC, glMatrixMult3x3fNV);
- q->matrixMultTranspose3x3f = PROC(PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC, glMatrixMultTranspose3x3fNV);
- q->stencilThenCoverFillPath = PROC(PFNGLSTENCILTHENCOVERFILLPATHNVPROC, glStencilThenCoverFillPathNV);
- q->stencilThenCoverStrokePath = PROC(PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC, glStencilThenCoverStrokePathNV);
- q->stencilThenCoverFillPathInstanced = PROC(PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC, glStencilThenCoverFillPathInstancedNV);
- q->stencilThenCoverStrokePathInstanced = PROC(PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC, glStencilThenCoverStrokePathInstancedNV);
- q->pathGlyphIndexRange = PROC(PFNGLPATHGLYPHINDEXRANGENVPROC, glPathGlyphIndexRangeNV);
- q->pathGlyphIndexArray = PROC(PFNGLPATHGLYPHINDEXARRAYNVPROC, glPathGlyphIndexArrayNV);
- q->pathMemoryGlyphIndexArray = PROC(PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC, glPathMemoryGlyphIndexArrayNV);
- q->programPathFragmentInputGen = PROC(PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC, glProgramPathFragmentInputGenNV);
- q->getProgramResourcefv = PROC(PFNGLGETPROGRAMRESOURCEFVNVPROC, glGetProgramResourcefvNV);
-
- q->matrixLoadf = PROC(PFNGLMATRIXLOADFEXTPROC, glMatrixLoadfEXT);
- q->matrixLoadIdentity = PROC(PFNGLMATRIXLOADIDENTITYEXTPROC, glMatrixLoadIdentityEXT);
-
- return q->genPaths != nullptr // base path rendering ext
- && q->programPathFragmentInputGen != nullptr // updated path rendering ext
- && q->matrixLoadf != nullptr // direct state access ext
- && q->matrixLoadIdentity != nullptr;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL
diff --git a/src/imports/shapes/qquicknvprfunctions_p.h b/src/imports/shapes/qquicknvprfunctions_p.h
deleted file mode 100644
index dd45dd7daa..0000000000
--- a/src/imports/shapes/qquicknvprfunctions_p.h
+++ /dev/null
@@ -1,400 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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 QQUICKNVPRFUNCTIONS_P_H
-#define QQUICKNVPRFUNCTIONS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of a number of Qt sources files. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qopengl.h>
-#include <QtGui/qsurfaceformat.h>
-
-#ifndef QT_NO_OPENGL
-
-QT_BEGIN_NAMESPACE
-
-// note: fixed pipeline specific functions are removed - modern ES ext
-// headers have all this, but not the fixed stuff
-
-#ifndef GL_NV_path_rendering
-#define GL_PATH_FORMAT_SVG_NV 0x9070
-#define GL_PATH_FORMAT_PS_NV 0x9071
-#define GL_STANDARD_FONT_NAME_NV 0x9072
-#define GL_SYSTEM_FONT_NAME_NV 0x9073
-#define GL_FILE_NAME_NV 0x9074
-#define GL_PATH_STROKE_WIDTH_NV 0x9075
-#define GL_PATH_END_CAPS_NV 0x9076
-#define GL_PATH_INITIAL_END_CAP_NV 0x9077
-#define GL_PATH_TERMINAL_END_CAP_NV 0x9078
-#define GL_PATH_JOIN_STYLE_NV 0x9079
-#define GL_PATH_MITER_LIMIT_NV 0x907A
-#define GL_PATH_DASH_CAPS_NV 0x907B
-#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C
-#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D
-#define GL_PATH_DASH_OFFSET_NV 0x907E
-#define GL_PATH_CLIENT_LENGTH_NV 0x907F
-#define GL_PATH_FILL_MODE_NV 0x9080
-#define GL_PATH_FILL_MASK_NV 0x9081
-#define GL_PATH_FILL_COVER_MODE_NV 0x9082
-#define GL_PATH_STROKE_COVER_MODE_NV 0x9083
-#define GL_PATH_STROKE_MASK_NV 0x9084
-#define GL_COUNT_UP_NV 0x9088
-#define GL_COUNT_DOWN_NV 0x9089
-#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A
-#define GL_CONVEX_HULL_NV 0x908B
-#define GL_BOUNDING_BOX_NV 0x908D
-#define GL_TRANSLATE_X_NV 0x908E
-#define GL_TRANSLATE_Y_NV 0x908F
-#define GL_TRANSLATE_2D_NV 0x9090
-#define GL_TRANSLATE_3D_NV 0x9091
-#define GL_AFFINE_2D_NV 0x9092
-#define GL_AFFINE_3D_NV 0x9094
-#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096
-#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098
-#define GL_UTF8_NV 0x909A
-#define GL_UTF16_NV 0x909B
-#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C
-#define GL_PATH_COMMAND_COUNT_NV 0x909D
-#define GL_PATH_COORD_COUNT_NV 0x909E
-#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F
-#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0
-#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1
-#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2
-#define GL_SQUARE_NV 0x90A3
-#define GL_ROUND_NV 0x90A4
-#define GL_TRIANGULAR_NV 0x90A5
-#define GL_BEVEL_NV 0x90A6
-#define GL_MITER_REVERT_NV 0x90A7
-#define GL_MITER_TRUNCATE_NV 0x90A8
-#define GL_SKIP_MISSING_GLYPH_NV 0x90A9
-#define GL_USE_MISSING_GLYPH_NV 0x90AA
-#define GL_PATH_ERROR_POSITION_NV 0x90AB
-#define GL_PATH_FOG_GEN_MODE_NV 0x90AC
-#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD
-#define GL_ADJACENT_PAIRS_NV 0x90AE
-#define GL_FIRST_TO_REST_NV 0x90AF
-#define GL_PATH_GEN_MODE_NV 0x90B0
-#define GL_PATH_GEN_COEFF_NV 0x90B1
-#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2
-#define GL_PATH_GEN_COMPONENTS_NV 0x90B3
-#define GL_PATH_STENCIL_FUNC_NV 0x90B7
-#define GL_PATH_STENCIL_REF_NV 0x90B8
-#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9
-#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD
-#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE
-#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF
-#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4
-#define GL_MOVE_TO_RESETS_NV 0x90B5
-#define GL_MOVE_TO_CONTINUES_NV 0x90B6
-#define GL_CLOSE_PATH_NV 0x00
-#define GL_MOVE_TO_NV 0x02
-#define GL_RELATIVE_MOVE_TO_NV 0x03
-#define GL_LINE_TO_NV 0x04
-#define GL_RELATIVE_LINE_TO_NV 0x05
-#define GL_HORIZONTAL_LINE_TO_NV 0x06
-#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07
-#define GL_VERTICAL_LINE_TO_NV 0x08
-#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09
-#define GL_QUADRATIC_CURVE_TO_NV 0x0A
-#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B
-#define GL_CUBIC_CURVE_TO_NV 0x0C
-#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D
-#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E
-#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F
-#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10
-#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11
-#define GL_SMALL_CCW_ARC_TO_NV 0x12
-#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13
-#define GL_SMALL_CW_ARC_TO_NV 0x14
-#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15
-#define GL_LARGE_CCW_ARC_TO_NV 0x16
-#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17
-#define GL_LARGE_CW_ARC_TO_NV 0x18
-#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19
-#define GL_RESTART_PATH_NV 0xF0
-#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2
-#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4
-#define GL_RECT_NV 0xF6
-#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8
-#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA
-#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC
-#define GL_ARC_TO_NV 0xFE
-#define GL_RELATIVE_ARC_TO_NV 0xFF
-#define GL_BOLD_BIT_NV 0x01
-#define GL_ITALIC_BIT_NV 0x02
-#define GL_GLYPH_WIDTH_BIT_NV 0x01
-#define GL_GLYPH_HEIGHT_BIT_NV 0x02
-#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04
-#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08
-#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10
-#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20
-#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40
-#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80
-#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100
-#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000
-#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000
-#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000
-#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000
-#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000
-#define GL_FONT_ASCENDER_BIT_NV 0x00200000
-#define GL_FONT_DESCENDER_BIT_NV 0x00400000
-#define GL_FONT_HEIGHT_BIT_NV 0x00800000
-#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000
-#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000
-#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000
-#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000
-#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000
-#define GL_PRIMARY_COLOR_NV 0x852C
-#define GL_SECONDARY_COLOR_NV 0x852D
-#define GL_ROUNDED_RECT_NV 0xE8
-#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9
-#define GL_ROUNDED_RECT2_NV 0xEA
-#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB
-#define GL_ROUNDED_RECT4_NV 0xEC
-#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED
-#define GL_ROUNDED_RECT8_NV 0xEE
-#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF
-#define GL_RELATIVE_RECT_NV 0xF7
-#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368
-#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369
-#define GL_FONT_UNAVAILABLE_NV 0x936A
-#define GL_FONT_UNINTELLIGIBLE_NV 0x936B
-#define GL_CONIC_CURVE_TO_NV 0x1A
-#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B
-#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000
-#define GL_STANDARD_FONT_FORMAT_NV 0x936C
-#define GL_2_BYTES_NV 0x1407
-#define GL_3_BYTES_NV 0x1408
-#define GL_4_BYTES_NV 0x1409
-#define GL_EYE_LINEAR_NV 0x2400
-#define GL_OBJECT_LINEAR_NV 0x2401
-#define GL_CONSTANT_NV 0x8576
-#define GL_PATH_PROJECTION_NV 0x1701
-#define GL_PATH_MODELVIEW_NV 0x1700
-#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3
-#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6
-#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36
-#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3
-#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4
-#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7
-#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38
-#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4
-#define GL_FRAGMENT_INPUT_NV 0x936D
-
-typedef GLuint (QOPENGLF_APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range);
-typedef void (QOPENGLF_APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range);
-typedef GLboolean (QOPENGLF_APIENTRYP PFNGLISPATHNVPROC) (GLuint path);
-typedef void (QOPENGLF_APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (QOPENGLF_APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (QOPENGLF_APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (QOPENGLF_APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (QOPENGLF_APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString);
-typedef void (QOPENGLF_APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef void (QOPENGLF_APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef void (QOPENGLF_APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);
-typedef void (QOPENGLF_APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath);
-typedef void (QOPENGLF_APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
-typedef void (QOPENGLF_APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);
-typedef void (QOPENGLF_APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value);
-typedef void (QOPENGLF_APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value);
-typedef void (QOPENGLF_APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value);
-typedef void (QOPENGLF_APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value);
-typedef void (QOPENGLF_APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray);
-typedef void (QOPENGLF_APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask);
-typedef void (QOPENGLF_APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units);
-typedef void (QOPENGLF_APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask);
-typedef void (QOPENGLF_APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask);
-typedef void (QOPENGLF_APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-typedef void (QOPENGLF_APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-typedef void (QOPENGLF_APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func);
-typedef void (QOPENGLF_APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode);
-typedef void (QOPENGLF_APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode);
-typedef void (QOPENGLF_APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (QOPENGLF_APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (QOPENGLF_APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value);
-typedef void (QOPENGLF_APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value);
-typedef void (QOPENGLF_APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands);
-typedef void (QOPENGLF_APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords);
-typedef void (QOPENGLF_APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray);
-typedef void (QOPENGLF_APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
-typedef void (QOPENGLF_APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);
-typedef void (QOPENGLF_APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
-typedef GLboolean (QOPENGLF_APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y);
-typedef GLboolean (QOPENGLF_APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y);
-typedef GLfloat (QOPENGLF_APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments);
-typedef GLboolean (QOPENGLF_APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
-typedef void (QOPENGLF_APIENTRYP PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (QOPENGLF_APIENTRYP PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (QOPENGLF_APIENTRYP PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (QOPENGLF_APIENTRYP PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (QOPENGLF_APIENTRYP PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (QOPENGLF_APIENTRYP PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (QOPENGLF_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
-typedef void (QOPENGLF_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode);
-typedef void (QOPENGLF_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (QOPENGLF_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef GLenum (QOPENGLF_APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]);
-typedef GLenum (QOPENGLF_APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef GLenum (QOPENGLF_APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef void (QOPENGLF_APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs);
-typedef void (QOPENGLF_APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params);
-#endif
-
-#ifndef GL_FLAT
-#define GL_FLAT 0x1D00
-#endif
-
-#ifndef GL_INVERT
-#define GL_INVERT 0x150A
-#endif
-
-// this one originates from fixed pipeline so may not be in GLES ext headers, but we need it still
-#ifndef GL_OBJECT_LINEAR_NV
-#define GL_OBJECT_LINEAR_NV 0x2401
-#endif
-
-#ifndef GL_EXT_direct_state_access
-typedef void (QOPENGLF_APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m);
-typedef void (QOPENGLF_APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode);
-#endif
-
-// When building on a system with GLES 2.0 or 3.0, we may still compile the NVPR
-// code path even though it's never used. Keep it compiling by defining the
-// necessary ES 3.1 separable program constants.
-#ifndef GL_FRAGMENT_SHADER_BIT
-#define GL_FRAGMENT_SHADER_BIT 0x00000002
-#endif
-#ifndef GL_UNIFORM
-#define GL_UNIFORM 0x92E1
-#endif
-
-class QQuickNvprFunctionsPrivate;
-
-class QQuickNvprFunctions
-{
-public:
- QQuickNvprFunctions();
- ~QQuickNvprFunctions();
-
- static QSurfaceFormat format();
- static bool isSupported();
-
- bool create();
-
- bool createFragmentOnlyPipeline(const char *fragmentShaderSource, GLuint *pipeline, GLuint *program);
-
- PFNGLGENPATHSNVPROC genPaths = nullptr;
- PFNGLDELETEPATHSNVPROC deletePaths = nullptr;
- PFNGLISPATHNVPROC isPath = nullptr;
- PFNGLPATHCOMMANDSNVPROC pathCommands = nullptr;
- PFNGLPATHCOORDSNVPROC pathCoords = nullptr;
- PFNGLPATHSUBCOMMANDSNVPROC pathSubCommands = nullptr;
- PFNGLPATHSUBCOORDSNVPROC pathSubCoords = nullptr;
- PFNGLPATHSTRINGNVPROC pathString = nullptr;
- PFNGLPATHGLYPHSNVPROC pathGlyphs = nullptr;
- PFNGLPATHGLYPHRANGENVPROC pathGlyphRange = nullptr;
- PFNGLWEIGHTPATHSNVPROC weightPaths = nullptr;
- PFNGLCOPYPATHNVPROC copyPath = nullptr;
- PFNGLINTERPOLATEPATHSNVPROC interpolatePaths = nullptr;
- PFNGLTRANSFORMPATHNVPROC transformPath = nullptr;
- PFNGLPATHPARAMETERIVNVPROC pathParameteriv = nullptr;
- PFNGLPATHPARAMETERINVPROC pathParameteri = nullptr;
- PFNGLPATHPARAMETERFVNVPROC pathParameterfv = nullptr;
- PFNGLPATHPARAMETERFNVPROC pathParameterf = nullptr;
- PFNGLPATHDASHARRAYNVPROC pathDashArray = nullptr;
- PFNGLPATHSTENCILFUNCNVPROC pathStencilFunc = nullptr;
- PFNGLPATHSTENCILDEPTHOFFSETNVPROC pathStencilDepthOffset = nullptr;
- PFNGLSTENCILFILLPATHNVPROC stencilFillPath = nullptr;
- PFNGLSTENCILSTROKEPATHNVPROC stencilStrokePath = nullptr;
- PFNGLSTENCILFILLPATHINSTANCEDNVPROC stencilFillPathInstanced = nullptr;
- PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC stencilStrokePathInstanced = nullptr;
- PFNGLPATHCOVERDEPTHFUNCNVPROC pathCoverDepthFunc = nullptr;
- PFNGLCOVERFILLPATHNVPROC coverFillPath = nullptr;
- PFNGLCOVERSTROKEPATHNVPROC coverStrokePath = nullptr;
- PFNGLCOVERFILLPATHINSTANCEDNVPROC coverFillPathInstanced = nullptr;
- PFNGLCOVERSTROKEPATHINSTANCEDNVPROC coverStrokePathInstanced = nullptr;
- PFNGLGETPATHPARAMETERIVNVPROC getPathParameteriv = nullptr;
- PFNGLGETPATHPARAMETERFVNVPROC getPathParameterfv = nullptr;
- PFNGLGETPATHCOMMANDSNVPROC getPathCommands = nullptr;
- PFNGLGETPATHCOORDSNVPROC getPathCoords = nullptr;
- PFNGLGETPATHDASHARRAYNVPROC getPathDashArray = nullptr;
- PFNGLGETPATHMETRICSNVPROC getPathMetrics = nullptr;
- PFNGLGETPATHMETRICRANGENVPROC getPathMetricRange = nullptr;
- PFNGLGETPATHSPACINGNVPROC getPathSpacing = nullptr;
- PFNGLISPOINTINFILLPATHNVPROC isPointInFillPath = nullptr;
- PFNGLISPOINTINSTROKEPATHNVPROC isPointInStrokePath = nullptr;
- PFNGLGETPATHLENGTHNVPROC getPathLength = nullptr;
- PFNGLPOINTALONGPATHNVPROC getPointAlongPath = nullptr;
- PFNGLMATRIXLOAD3X2FNVPROC matrixLoad3x2f = nullptr;
- PFNGLMATRIXLOAD3X3FNVPROC matrixLoad3x3f = nullptr;
- PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC matrixLoadTranspose3x3f = nullptr;
- PFNGLMATRIXMULT3X2FNVPROC matrixMult3x2f = nullptr;
- PFNGLMATRIXMULT3X3FNVPROC matrixMult3x3f = nullptr;
- PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC matrixMultTranspose3x3f = nullptr;
- PFNGLSTENCILTHENCOVERFILLPATHNVPROC stencilThenCoverFillPath = nullptr;
- PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC stencilThenCoverStrokePath = nullptr;
- PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC stencilThenCoverFillPathInstanced = nullptr;
- PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC stencilThenCoverStrokePathInstanced = nullptr;
- PFNGLPATHGLYPHINDEXRANGENVPROC pathGlyphIndexRange = nullptr;
- PFNGLPATHGLYPHINDEXARRAYNVPROC pathGlyphIndexArray = nullptr;
- PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC pathMemoryGlyphIndexArray = nullptr;
- PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC programPathFragmentInputGen = nullptr;
- PFNGLGETPROGRAMRESOURCEFVNVPROC getProgramResourcefv = nullptr;
-
- PFNGLMATRIXLOADFEXTPROC matrixLoadf = nullptr;
- PFNGLMATRIXLOADIDENTITYEXTPROC matrixLoadIdentity = nullptr;
-
-private:
- QQuickNvprFunctionsPrivate *d;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL
-
-#endif // QQUICKNVPRFUNCTIONS_P_H
diff --git a/src/imports/shapes/qquickshape.cpp b/src/imports/shapes/qquickshape.cpp
deleted file mode 100644
index 4e6896621e..0000000000
--- a/src/imports/shapes/qquickshape.cpp
+++ /dev/null
@@ -1,1331 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qquickshape_p.h"
-#include "qquickshape_p_p.h"
-#include "qquickshapegenericrenderer_p.h"
-#include "qquickshapenvprrenderer_p.h"
-#include "qquickshapesoftwarerenderer_p.h"
-#include <private/qsgtexture_p.h>
-#include <private/qquicksvgparser_p.h>
-#include <QtGui/private/qdrawhelper_p.h>
-#include <QOpenGLFunctions>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlmodule QtQuick.Shapes 1.0
- \title Qt Quick Shapes QML Types
- \ingroup qmlmodules
- \brief Provides QML types for drawing stroked and filled shapes
-
- To use the types in this module, import the module with the following line:
-
- \code
- import QtQuick.Shapes 1.0
- \endcode
-*/
-
-QQuickShapeStrokeFillParams::QQuickShapeStrokeFillParams()
- : strokeColor(Qt::white),
- strokeWidth(1),
- fillColor(Qt::white),
- fillRule(QQuickShapePath::OddEvenFill),
- joinStyle(QQuickShapePath::BevelJoin),
- miterLimit(2),
- capStyle(QQuickShapePath::SquareCap),
- strokeStyle(QQuickShapePath::SolidLine),
- dashOffset(0),
- fillGradient(nullptr)
-{
- dashPattern << 4 << 2; // 4 * strokeWidth dash followed by 2 * strokeWidth space
-}
-
-QPainterPath QQuickShapePathCommands::toPainterPath() const
-{
- QPainterPath p;
- int coordIdx = 0;
- for (int i = 0; i < cmd.count(); ++i) {
- switch (cmd[i]) {
- case QQuickShapePathCommands::MoveTo:
- p.moveTo(coords[coordIdx], coords[coordIdx + 1]);
- coordIdx += 2;
- break;
- case QQuickShapePathCommands::LineTo:
- p.lineTo(coords[coordIdx], coords[coordIdx + 1]);
- coordIdx += 2;
- break;
- case QQuickShapePathCommands::QuadTo:
- p.quadTo(coords[coordIdx], coords[coordIdx + 1],
- coords[coordIdx + 2], coords[coordIdx + 3]);
- coordIdx += 4;
- break;
- case QQuickShapePathCommands::CubicTo:
- p.cubicTo(coords[coordIdx], coords[coordIdx + 1],
- coords[coordIdx + 2], coords[coordIdx + 3],
- coords[coordIdx + 4], coords[coordIdx + 5]);
- coordIdx += 6;
- break;
- case QQuickShapePathCommands::ArcTo:
- // does not map to the QPainterPath API; reuse the helper code from QQuickSvgParser
- QQuickSvgParser::pathArc(p,
- coords[coordIdx], coords[coordIdx + 1], // radius
- coords[coordIdx + 2], // xAxisRotation
- !qFuzzyIsNull(coords[coordIdx + 6]), // useLargeArc
- !qFuzzyIsNull(coords[coordIdx + 5]), // sweep flag
- coords[coordIdx + 3], coords[coordIdx + 4], // end
- p.currentPosition().x(), p.currentPosition().y());
- coordIdx += 7;
- break;
- default:
- qWarning("Unknown JS path command: %d", cmd[i]);
- break;
- }
- }
- return p;
-}
-
-/*!
- \qmltype ShapePath
- \instantiates QQuickShapePath
- \inqmlmodule QtQuick.Shapes
- \ingroup qtquick-paths
- \ingroup qtquick-views
- \inherits Path
- \brief Describes a Path and associated properties for stroking and filling
- \since 5.10
-
- A Shape contains one or more ShapePath elements. At least one ShapePath is
- necessary in order to have a Shape output anything visible. A ShapePath
- itself is a \l Path with additional properties describing the stroking and
- filling parameters, such as the stroke width and color, the fill color or
- gradient, join and cap styles, and so on. As with ordinary \l Path objects,
- ShapePath also contains a list of path elements like \l PathMove, \l PathLine,
- \l PathCubic, \l PathQuad, \l PathArc, together with a starting position.
-
- Any property changes in these data sets will be bubble up and change the
- output of the Shape. This means that it is simple and easy to change, or
- even animate, the starting and ending position, control points, or any
- stroke or fill parameters using the usual QML bindings and animation types
- like NumberAnimation.
-
- In the following example the line join style changes automatically based on
- the value of joinStyleIndex:
-
- \code
- ShapePath {
- strokeColor: "black"
- strokeWidth: 16
- fillColor: "transparent"
- capStyle: ShapePath.RoundCap
-
- property int joinStyleIndex: 0
- property variant styles: [ ShapePath.BevelJoin, ShapePath.MiterJoin, ShapePath.RoundJoin ]
-
- joinStyle: styles[joinStyleIndex]
-
- startX: 30
- startY: 30
- PathLine { x: 100; y: 100 }
- PathLine { x: 30; y: 100 }
- }
- \endcode
-
- Once associated with a Shape, here is the output with a joinStyleIndex
- of 2 (ShapePath.RoundJoin):
-
- \image visualpath-code-example.png
- */
-
-QQuickShapePathPrivate::QQuickShapePathPrivate()
- : dirty(DirtyAll)
-{
-}
-
-QQuickShapePath::QQuickShapePath(QObject *parent)
- : QQuickPath(*(new QQuickShapePathPrivate), parent)
-{
- // The inherited changed() and the shapePathChanged() signals remain
- // distinct, and this is intentional. Combining the two is not possible due
- // to the difference in semantics and the need to act (see dirty flag
- // below) differently on QQuickPath-related changes.
-
- connect(this, &QQuickPath::changed, [this]() {
- Q_D(QQuickShapePath);
- d->dirty |= QQuickShapePathPrivate::DirtyPath;
- emit shapePathChanged();
- });
-}
-
-QQuickShapePath::~QQuickShapePath()
-{
-}
-
-/*!
- \qmlproperty color QtQuick.Shapes::ShapePath::strokeColor
-
- This property holds the stroking color.
-
- When set to \c transparent, no stroking occurs.
-
- The default value is \c white.
- */
-
-QColor QQuickShapePath::strokeColor() const
-{
- Q_D(const QQuickShapePath);
- return d->sfp.strokeColor;
-}
-
-void QQuickShapePath::setStrokeColor(const QColor &color)
-{
- Q_D(QQuickShapePath);
- if (d->sfp.strokeColor != color) {
- d->sfp.strokeColor = color;
- d->dirty |= QQuickShapePathPrivate::DirtyStrokeColor;
- emit strokeColorChanged();
- emit shapePathChanged();
- }
-}
-
-/*!
- \qmlproperty color QtQuick.Shapes::ShapePath::strokeWidth
-
- This property holds the stroke width.
-
- When set to a negative value, no stroking occurs.
-
- The default value is 1.
- */
-
-qreal QQuickShapePath::strokeWidth() const
-{
- Q_D(const QQuickShapePath);
- return d->sfp.strokeWidth;
-}
-
-void QQuickShapePath::setStrokeWidth(qreal w)
-{
- Q_D(QQuickShapePath);
- if (d->sfp.strokeWidth != w) {
- d->sfp.strokeWidth = w;
- d->dirty |= QQuickShapePathPrivate::DirtyStrokeWidth;
- emit strokeWidthChanged();
- emit shapePathChanged();
- }
-}
-
-/*!
- \qmlproperty color QtQuick.Shapes::ShapePath::fillColor
-
- This property holds the fill color.
-
- When set to \c transparent, no filling occurs.
-
- The default value is \c white.
- */
-
-QColor QQuickShapePath::fillColor() const
-{
- Q_D(const QQuickShapePath);
- return d->sfp.fillColor;
-}
-
-void QQuickShapePath::setFillColor(const QColor &color)
-{
- Q_D(QQuickShapePath);
- if (d->sfp.fillColor != color) {
- d->sfp.fillColor = color;
- d->dirty |= QQuickShapePathPrivate::DirtyFillColor;
- emit fillColorChanged();
- emit shapePathChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration QtQuick.Shapes::ShapePath::fillRule
-
- This property holds the fill rule. The default value is
- ShapePath.OddEvenFill. For an example on fill rules, see
- QPainterPath::setFillRule().
-
- \list
- \li ShapePath.OddEvenFill
- \li ShapePath.WindingFill
- \endlist
- */
-
-QQuickShapePath::FillRule QQuickShapePath::fillRule() const
-{
- Q_D(const QQuickShapePath);
- return d->sfp.fillRule;
-}
-
-void QQuickShapePath::setFillRule(FillRule fillRule)
-{
- Q_D(QQuickShapePath);
- if (d->sfp.fillRule != fillRule) {
- d->sfp.fillRule = fillRule;
- d->dirty |= QQuickShapePathPrivate::DirtyFillRule;
- emit fillRuleChanged();
- emit shapePathChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration QtQuick.Shapes::ShapePath::joinStyle
-
- This property defines how joins between two connected lines are drawn. The
- default value is ShapePath.BevelJoin.
-
- \list
- \li ShapePath.MiterJoin - The outer edges of the lines are extended to meet at an angle, and this area is filled.
- \li ShapePath.BevelJoin - The triangular notch between the two lines is filled.
- \li ShapePath.RoundJoin - A circular arc between the two lines is filled.
- \endlist
- */
-
-QQuickShapePath::JoinStyle QQuickShapePath::joinStyle() const
-{
- Q_D(const QQuickShapePath);
- return d->sfp.joinStyle;
-}
-
-void QQuickShapePath::setJoinStyle(JoinStyle style)
-{
- Q_D(QQuickShapePath);
- if (d->sfp.joinStyle != style) {
- d->sfp.joinStyle = style;
- d->dirty |= QQuickShapePathPrivate::DirtyStyle;
- emit joinStyleChanged();
- emit shapePathChanged();
- }
-}
-
-/*!
- \qmlproperty int QtQuick.Shapes::ShapePath::miterLimit
-
- When ShapePath.joinStyle is set to ShapePath.MiterJoin, this property
- specifies how far the miter join can extend from the join point.
-
- The default value is 2.
- */
-
-int QQuickShapePath::miterLimit() const
-{
- Q_D(const QQuickShapePath);
- return d->sfp.miterLimit;
-}
-
-void QQuickShapePath::setMiterLimit(int limit)
-{
- Q_D(QQuickShapePath);
- if (d->sfp.miterLimit != limit) {
- d->sfp.miterLimit = limit;
- d->dirty |= QQuickShapePathPrivate::DirtyStyle;
- emit miterLimitChanged();
- emit shapePathChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration QtQuick.Shapes::ShapePath::capStyle
-
- This property defines how the end points of lines are drawn. The
- default value is ShapePath.SquareCap.
-
- \list
- \li ShapePath.FlatCap - A square line end that does not cover the end point of the line.
- \li ShapePath.SquareCap - A square line end that covers the end point and extends beyond it by half the line width.
- \li ShapePath.RoundCap - A rounded line end.
- \endlist
- */
-
-QQuickShapePath::CapStyle QQuickShapePath::capStyle() const
-{
- Q_D(const QQuickShapePath);
- return d->sfp.capStyle;
-}
-
-void QQuickShapePath::setCapStyle(CapStyle style)
-{
- Q_D(QQuickShapePath);
- if (d->sfp.capStyle != style) {
- d->sfp.capStyle = style;
- d->dirty |= QQuickShapePathPrivate::DirtyStyle;
- emit capStyleChanged();
- emit shapePathChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration QtQuick.Shapes::ShapePath::strokeStyle
-
- This property defines the style of stroking. The default value is
- ShapePath.SolidLine.
-
- \list
- \li ShapePath.SolidLine - A plain line.
- \li ShapePath.DashLine - Dashes separated by a few pixels.
- \endlist
- */
-
-QQuickShapePath::StrokeStyle QQuickShapePath::strokeStyle() const
-{
- Q_D(const QQuickShapePath);
- return d->sfp.strokeStyle;
-}
-
-void QQuickShapePath::setStrokeStyle(StrokeStyle style)
-{
- Q_D(QQuickShapePath);
- if (d->sfp.strokeStyle != style) {
- d->sfp.strokeStyle = style;
- d->dirty |= QQuickShapePathPrivate::DirtyDash;
- emit strokeStyleChanged();
- emit shapePathChanged();
- }
-}
-
-/*!
- \qmlproperty real QtQuick.Shapes::ShapePath::dashOffset
-
- This property defines the starting point on the dash pattern, measured in
- units used to specify the dash pattern.
-
- The default value is 0.
-
- \sa QPen::setDashOffset()
- */
-
-qreal QQuickShapePath::dashOffset() const
-{
- Q_D(const QQuickShapePath);
- return d->sfp.dashOffset;
-}
-
-void QQuickShapePath::setDashOffset(qreal offset)
-{
- Q_D(QQuickShapePath);
- if (d->sfp.dashOffset != offset) {
- d->sfp.dashOffset = offset;
- d->dirty |= QQuickShapePathPrivate::DirtyDash;
- emit dashOffsetChanged();
- emit shapePathChanged();
- }
-}
-
-/*!
- \qmlproperty list<real> QtQuick.Shapes::ShapePath::dashPattern
-
- This property defines the dash pattern when ShapePath.strokeStyle is set
- to ShapePath.DashLine. The pattern must be specified as an even number of
- positive entries where the entries 1, 3, 5... are the dashes and 2, 4, 6...
- are the spaces. The pattern is specified in units of the pen's width.
-
- The default value is (4, 2), meaning a dash of 4 * ShapePath.strokeWidth
- pixels followed by a space of 2 * ShapePath.strokeWidth pixels.
-
- \sa QPen::setDashPattern()
- */
-
-QVector<qreal> QQuickShapePath::dashPattern() const
-{
- Q_D(const QQuickShapePath);
- return d->sfp.dashPattern;
-}
-
-void QQuickShapePath::setDashPattern(const QVector<qreal> &array)
-{
- Q_D(QQuickShapePath);
- if (d->sfp.dashPattern != array) {
- d->sfp.dashPattern = array;
- d->dirty |= QQuickShapePathPrivate::DirtyDash;
- emit dashPatternChanged();
- emit shapePathChanged();
- }
-}
-
-/*!
- \qmlproperty ShapeGradient QtQuick.Shapes::ShapePath::fillGradient
-
- This property defines the fill gradient. By default no gradient is enabled
- and the value is \c null. In this case the fill uses a solid color based on
- the value of ShapePath.fillColor.
-
- When set, ShapePath.fillColor is ignored and filling is done using one of
- the ShapeGradient subtypes.
-
- \note The Gradient type cannot be used here. Rather, prefer using one of the
- advanced subtypes, like LinearGradient.
- */
-
-QQuickShapeGradient *QQuickShapePath::fillGradient() const
-{
- Q_D(const QQuickShapePath);
- return d->sfp.fillGradient;
-}
-
-void QQuickShapePath::setFillGradient(QQuickShapeGradient *gradient)
-{
- Q_D(QQuickShapePath);
- if (d->sfp.fillGradient != gradient) {
- if (d->sfp.fillGradient)
- qmlobject_disconnect(d->sfp.fillGradient, QQuickShapeGradient, SIGNAL(updated()),
- this, QQuickShapePath, SLOT(_q_fillGradientChanged()));
- d->sfp.fillGradient = gradient;
- if (d->sfp.fillGradient)
- qmlobject_connect(d->sfp.fillGradient, QQuickShapeGradient, SIGNAL(updated()),
- this, QQuickShapePath, SLOT(_q_fillGradientChanged()));
- d->dirty |= QQuickShapePathPrivate::DirtyFillGradient;
- emit shapePathChanged();
- }
-}
-
-void QQuickShapePathPrivate::_q_fillGradientChanged()
-{
- Q_Q(QQuickShapePath);
- dirty |= DirtyFillGradient;
- emit q->shapePathChanged();
-}
-
-void QQuickShapePath::resetFillGradient()
-{
- setFillGradient(nullptr);
-}
-
-/*!
- \qmltype Shape
- \instantiates QQuickShape
- \inqmlmodule QtQuick.Shapes
- \ingroup qtquick-paths
- \ingroup qtquick-views
- \inherits Item
- \brief Renders a path
- \since 5.10
-
- Renders a path either by generating geometry via QPainterPath and manual
- triangulation or by using a GPU vendor extension like \c{GL_NV_path_rendering}.
-
- This approach is different from rendering shapes via QQuickPaintedItem or
- the 2D Canvas because the path never gets rasterized in software. Therefore
- Shape is suitable for creating shapes spreading over larger areas of the
- screen, avoiding the performance penalty for texture uploads or framebuffer
- blits. In addition, the declarative API allows manipulating, binding to,
- and even animating the path element properties like starting and ending
- position, the control points, etc.
-
- The types for specifying path elements are shared between \l PathView and
- Shape. However, not all Shape implementations support all path
- element types, while some may not make sense for PathView. Shape's
- currently supported subset is: PathMove, PathLine, PathQuad, PathCubic,
- PathArc, PathSvg.
-
- See \l Path for a detailed overview of the supported path elements.
-
- \code
- Shape {
- width: 200
- height: 150
- anchors.centerIn: parent
- ShapePath {
- strokeWidth: 4
- strokeColor: "red"
- fillGradient: LinearGradient {
- x1: 20; y1: 20
- x2: 180; y2: 130
- GradientStop { position: 0; color: "blue" }
- GradientStop { position: 0.2; color: "green" }
- GradientStop { position: 0.4; color: "red" }
- GradientStop { position: 0.6; color: "yellow" }
- GradientStop { position: 1; color: "cyan" }
- }
- strokeStyle: ShapePath.DashLine
- dashPattern: [ 1, 4 ]
- startX: 20; startY: 20
- PathLine { x: 180; y: 130 }
- PathLine { x: 20; y: 130 }
- PathLine { x: 20; y: 20 }
- }
- }
- \endcode
-
- \image pathitem-code-example.png
-
- Like \l Item, Shape also allows any visual or non-visual objects to be
- declared as children. ShapePath objects are handled specially. This is
- useful since it allows adding visual items, like \l Rectangle or \l Image,
- and non-visual objects, like \l Timer directly as children of Shape.
-
- \note It is important to be aware of performance implications, in particular
- when the application is running on the generic Shape implementation due to
- not having support for accelerated path rendering. The geometry generation
- happens entirely on the CPU in this case, and this is potentially
- expensive. Changing the set of path elements, changing the properties of
- these elements, or changing certain properties of the Shape itself all lead
- to retriangulation of the affected elements on every change. Therefore,
- applying animation to such properties can affect performance on less
- powerful systems. If animating properties other than stroke and fill colors
- is a must, it is recommended to target systems providing
- \c{GL_NV_path_rendering} where the cost of path property changes is much
- smaller.
-
- \note However, the data-driven, declarative nature of the Shape API often
- means better cacheability for the underlying CPU and GPU resources. A
- property change in one ShapePath will only lead to reprocessing the affected
- ShapePath, leaving other parts of the Shape unchanged. Therefore, a heavily
- changing (for example, animating) property can often result in a lower
- overall system load than with imperative painting approaches (for example,
- QPainter).
-
- The following list summarizes the available Shape rendering approaches:
-
- \list
-
- \li When running with the default, OpenGL backend of Qt Quick, both the
- generic, triangulation-based and the NVIDIA-specific
- \c{GL_NV_path_rendering} methods are available. The choice is made at
- runtime, depending on the graphics driver's capabilities. When this is not
- desired, applications can force using the generic method by setting the
- Shape.vendorExtensionsEnabled property to \c false.
-
- \li The \c software backend is fully supported. The path is rendered via
- QPainter::strokePath() and QPainter::fillPath() in this case.
-
- \li The Direct 3D 12 backend is not currently supported.
-
- \li The OpenVG backend is not currently supported.
-
- \endlist
-
- \sa Path, PathMove, PathLine, PathQuad, PathCubic, PathArc, PathSvg
-*/
-
-QQuickShapePrivate::QQuickShapePrivate()
- : componentComplete(true),
- spChanged(false),
- rendererType(QQuickShape::UnknownRenderer),
- async(false),
- status(QQuickShape::Null),
- renderer(nullptr),
- enableVendorExts(true)
-{
-}
-
-QQuickShapePrivate::~QQuickShapePrivate()
-{
- delete renderer;
-}
-
-void QQuickShapePrivate::_q_shapePathChanged()
-{
- Q_Q(QQuickShape);
- spChanged = true;
- q->polish();
-}
-
-void QQuickShapePrivate::setStatus(QQuickShape::Status newStatus)
-{
- Q_Q(QQuickShape);
- if (status != newStatus) {
- status = newStatus;
- emit q->statusChanged();
- }
-}
-
-QQuickShape::QQuickShape(QQuickItem *parent)
- : QQuickItem(*(new QQuickShapePrivate), parent)
-{
- setFlag(ItemHasContents);
-}
-
-QQuickShape::~QQuickShape()
-{
-}
-
-/*!
- \qmlproperty enumeration QtQuick.Shapes::Shape::rendererType
-
- This property determines which path rendering backend is active.
-
- \list
-
- \li Shape.UnknownRenderer - The renderer is unknown.
-
- \li Shape.GeometryRenderer - The generic, driver independent solution
- for OpenGL. Uses the same CPU-based triangulation approach as QPainter's
- OpenGL 2 paint engine. This is the default on non-NVIDIA hardware when the
- default, OpenGL Qt Quick scenegraph backend is in use.
-
- \li Shape.NvprRenderer - Path items are rendered by performing OpenGL
- calls using the \c{GL_NV_path_rendering} extension. This is the default on
- NVIDIA hardware when the default, OpenGL Qt Quick scenegraph backend is in
- use.
-
- \li Shape.SoftwareRenderer - Pure QPainter drawing using the raster
- paint engine. This is the default, and only, option when the Qt Quick
- scenegraph is running with the \c software backend.
-
- \endlist
-*/
-
-QQuickShape::RendererType QQuickShape::rendererType() const
-{
- Q_D(const QQuickShape);
- return d->rendererType;
-}
-
-/*!
- \qmlproperty bool QtQuick.Shapes::Shape::asynchronous
-
- When Shape.rendererType is Shape.GeometryRenderer, the input path is
- triangulated on the CPU during the polishing phase of the Shape. This is
- potentially expensive. To offload this work to separate worker threads, set
- this property to \c true.
-
- When enabled, making a Shape visible will not wait for the content to
- become available. Instead, the gui/main thread is not blocked and the
- results of the path rendering are shown only when all the asynchronous work
- has been finished.
-
- The default value is \c false.
- */
-
-bool QQuickShape::asynchronous() const
-{
- Q_D(const QQuickShape);
- return d->async;
-}
-
-void QQuickShape::setAsynchronous(bool async)
-{
- Q_D(QQuickShape);
- if (d->async != async) {
- d->async = async;
- emit asynchronousChanged();
- if (d->componentComplete)
- d->_q_shapePathChanged();
- }
-}
-
-/*!
- \qmlproperty bool QtQuick.Shapes::Shape::vendorExtensionsEnabled
-
- This property controls the usage of non-standard OpenGL extensions like
- GL_NV_path_rendering. To disable Shape.NvprRenderer and force a uniform
- behavior regardless of the graphics card and drivers, set this property to
- \c false.
-
- The default value is \c true.
- */
-
-bool QQuickShape::vendorExtensionsEnabled() const
-{
- Q_D(const QQuickShape);
- return d->enableVendorExts;
-}
-
-void QQuickShape::setVendorExtensionsEnabled(bool enable)
-{
- Q_D(QQuickShape);
- if (d->enableVendorExts != enable) {
- d->enableVendorExts = enable;
- emit vendorExtensionsEnabledChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration QtQuick.Shapes::Shape::status
-
- This property determines the status of the Shape and is relevant when
- Shape.asynchronous is set to \c true.
-
- \list
-
- \li Shape.Null - Not yet initialized.
-
- \li Shape.Ready - The Shape has finished processing.
-
- \li Shape.Processing - The path is being processed.
-
- \endlist
- */
-
-QQuickShape::Status QQuickShape::status() const
-{
- Q_D(const QQuickShape);
- return d->status;
-}
-
-static void vpe_append(QQmlListProperty<QObject> *property, QObject *obj)
-{
- QQuickShape *item = static_cast<QQuickShape *>(property->object);
- QQuickShapePrivate *d = QQuickShapePrivate::get(item);
- QQuickShapePath *path = qobject_cast<QQuickShapePath *>(obj);
- if (path)
- d->qmlData.sp.append(path);
-
- QQuickItemPrivate::data_append(property, obj);
-
- if (path && d->componentComplete) {
- QObject::connect(path, SIGNAL(shapePathChanged()), item, SLOT(_q_shapePathChanged()));
- d->_q_shapePathChanged();
- }
-}
-
-static void vpe_clear(QQmlListProperty<QObject> *property)
-{
- QQuickShape *item = static_cast<QQuickShape *>(property->object);
- QQuickShapePrivate *d = QQuickShapePrivate::get(item);
-
- for (QQuickShapePath *p : d->qmlData.sp)
- QObject::disconnect(p, SIGNAL(shapePathChanged()), item, SLOT(_q_shapePathChanged()));
-
- d->qmlData.sp.clear();
-
- QQuickItemPrivate::data_clear(property);
-
- if (d->componentComplete)
- d->_q_shapePathChanged();
-}
-
-/*!
- \qmlproperty list<Object> QtQuick.Shapes::Shape::data
-
- This property holds the ShapePath objects that define the contents of the
- Shape. It can also contain any other type of objects, since Shape, like Item,
- allows adding any visual or non-visual objects as children.
-
- \default
- */
-
-QQmlListProperty<QObject> QQuickShape::data()
-{
- return QQmlListProperty<QObject>(this,
- nullptr,
- vpe_append,
- QQuickItemPrivate::data_count,
- QQuickItemPrivate::data_at,
- vpe_clear);
-}
-
-void QQuickShape::classBegin()
-{
- Q_D(QQuickShape);
- d->componentComplete = false;
-}
-
-void QQuickShape::componentComplete()
-{
- Q_D(QQuickShape);
- d->componentComplete = true;
-
- for (QQuickShapePath *p : d->qmlData.sp)
- connect(p, SIGNAL(shapePathChanged()), this, SLOT(_q_shapePathChanged()));
-
- d->_q_shapePathChanged();
-}
-
-void QQuickShape::updatePolish()
-{
- Q_D(QQuickShape);
-
- if (!d->spChanged)
- return;
-
- d->spChanged = false;
-
- if (!d->renderer) {
- d->createRenderer();
- if (!d->renderer)
- return;
- emit rendererChanged();
- }
-
- // endSync() is where expensive calculations may happen (or get kicked off
- // on worker threads), depending on the backend. Therefore do this only
- // when the item is visible.
- if (isVisible())
- d->sync();
-
- update();
-}
-
-void QQuickShape::itemChange(ItemChange change, const ItemChangeData &data)
-{
- Q_D(QQuickShape);
-
- // sync may have been deferred; do it now if the item became visible
- if (change == ItemVisibleHasChanged && data.boolValue)
- d->_q_shapePathChanged();
-
- QQuickItem::itemChange(change, data);
-}
-
-QSGNode *QQuickShape::updatePaintNode(QSGNode *node, UpdatePaintNodeData *)
-{
- // Called on the render thread, with the gui thread blocked. We can now
- // safely access gui thread data.
-
- Q_D(QQuickShape);
- if (d->renderer) {
- if (!node)
- node = d->createNode();
- d->renderer->updateNode();
- }
- return node;
-}
-
-// the renderer object lives on the gui thread
-void QQuickShapePrivate::createRenderer()
-{
- Q_Q(QQuickShape);
- QSGRendererInterface *ri = q->window()->rendererInterface();
- if (!ri)
- return;
-
- switch (ri->graphicsApi()) {
-#ifndef QT_NO_OPENGL
- case QSGRendererInterface::OpenGL:
- if (enableVendorExts && QQuickShapeNvprRenderNode::isSupported()) {
- rendererType = QQuickShape::NvprRenderer;
- renderer = new QQuickShapeNvprRenderer;
- } else {
- rendererType = QQuickShape::GeometryRenderer;
- renderer = new QQuickShapeGenericRenderer(q);
- }
- break;
-#endif
- case QSGRendererInterface::Software:
- rendererType = QQuickShape::SoftwareRenderer;
- renderer = new QQuickShapeSoftwareRenderer;
- break;
- default:
- qWarning("No path backend for this graphics API yet");
- break;
- }
-}
-
-// the node lives on the render thread
-QSGNode *QQuickShapePrivate::createNode()
-{
- Q_Q(QQuickShape);
- QSGNode *node = nullptr;
- if (!q->window())
- return node;
- QSGRendererInterface *ri = q->window()->rendererInterface();
- if (!ri)
- return node;
-
- switch (ri->graphicsApi()) {
-#ifndef QT_NO_OPENGL
- case QSGRendererInterface::OpenGL:
- if (enableVendorExts && QQuickShapeNvprRenderNode::isSupported()) {
- node = new QQuickShapeNvprRenderNode;
- static_cast<QQuickShapeNvprRenderer *>(renderer)->setNode(
- static_cast<QQuickShapeNvprRenderNode *>(node));
- } else {
- node = new QQuickShapeGenericNode;
- static_cast<QQuickShapeGenericRenderer *>(renderer)->setRootNode(
- static_cast<QQuickShapeGenericNode *>(node));
- }
- break;
-#endif
- case QSGRendererInterface::Software:
- node = new QQuickShapeSoftwareRenderNode(q);
- static_cast<QQuickShapeSoftwareRenderer *>(renderer)->setNode(
- static_cast<QQuickShapeSoftwareRenderNode *>(node));
- break;
- default:
- qWarning("No path backend for this graphics API yet");
- break;
- }
-
- return node;
-}
-
-static void q_asyncShapeReady(void *data)
-{
- QQuickShapePrivate *self = static_cast<QQuickShapePrivate *>(data);
- self->setStatus(QQuickShape::Ready);
-}
-
-void QQuickShapePrivate::sync()
-{
- const bool useAsync = async && renderer->flags().testFlag(QQuickAbstractPathRenderer::SupportsAsync);
- if (useAsync) {
- setStatus(QQuickShape::Processing);
- renderer->setAsyncCallback(q_asyncShapeReady, this);
- }
-
- if (!jsData.isValid()) {
- // Standard route: The path and stroke/fill parameters are provided via
- // QML elements.
- const int count = qmlData.sp.count();
- renderer->beginSync(count);
-
- for (int i = 0; i < count; ++i) {
- QQuickShapePath *p = qmlData.sp[i];
- int &dirty(QQuickShapePathPrivate::get(p)->dirty);
-
- if (dirty & QQuickShapePathPrivate::DirtyPath)
- renderer->setPath(i, p);
- if (dirty & QQuickShapePathPrivate::DirtyStrokeColor)
- renderer->setStrokeColor(i, p->strokeColor());
- if (dirty & QQuickShapePathPrivate::DirtyStrokeWidth)
- renderer->setStrokeWidth(i, p->strokeWidth());
- if (dirty & QQuickShapePathPrivate::DirtyFillColor)
- renderer->setFillColor(i, p->fillColor());
- if (dirty & QQuickShapePathPrivate::DirtyFillRule)
- renderer->setFillRule(i, p->fillRule());
- if (dirty & QQuickShapePathPrivate::DirtyStyle) {
- renderer->setJoinStyle(i, p->joinStyle(), p->miterLimit());
- renderer->setCapStyle(i, p->capStyle());
- }
- if (dirty & QQuickShapePathPrivate::DirtyDash)
- renderer->setStrokeStyle(i, p->strokeStyle(), p->dashOffset(), p->dashPattern());
- if (dirty & QQuickShapePathPrivate::DirtyFillGradient)
- renderer->setFillGradient(i, p->fillGradient());
-
- dirty = 0;
- }
-
- renderer->endSync(useAsync);
- } else {
-
- // ### there is no public API to reach this code path atm
- Q_UNREACHABLE();
-
- // Path and stroke/fill params provided from JavaScript. This avoids
- // QObjects at the expense of not supporting changes afterwards.
- const int count = jsData.paths.count();
- renderer->beginSync(count);
-
- for (int i = 0; i < count; ++i) {
- renderer->setJSPath(i, jsData.paths[i]);
- const QQuickShapeStrokeFillParams sfp(jsData.sfp[i]);
- renderer->setStrokeColor(i, sfp.strokeColor);
- renderer->setStrokeWidth(i, sfp.strokeWidth);
- renderer->setFillColor(i, sfp.fillColor);
- renderer->setFillRule(i, sfp.fillRule);
- renderer->setJoinStyle(i, sfp.joinStyle, sfp.miterLimit);
- renderer->setCapStyle(i, sfp.capStyle);
- renderer->setStrokeStyle(i, sfp.strokeStyle, sfp.dashOffset, sfp.dashPattern);
- renderer->setFillGradient(i, sfp.fillGradient);
- }
-
- renderer->endSync(useAsync);
- }
-
- if (!useAsync)
- setStatus(QQuickShape::Ready);
-}
-
-// ***** gradient support *****
-
-/*!
- \qmltype ShapeGradient
- \instantiates QQuickShapeGradient
- \inqmlmodule QtQuick.Shapes
- \ingroup qtquick-paths
- \ingroup qtquick-views
- \inherits Gradient
- \brief Base type of Shape fill gradients
- \since 5.10
-
- This is an abstract base class for gradients like LinearGradient and
- cannot be created directly. It extends \l Gradient with properties like the
- spread mode.
- */
-
-QQuickShapeGradient::QQuickShapeGradient(QObject *parent)
- : QQuickGradient(parent),
- m_spread(PadSpread)
-{
-}
-
-/*!
- \qmlproperty enumeration QtQuick.Shapes::ShapeGradient::spread
-
- Specifies how the area outside the gradient area should be filled. The
- default value is ShapeGradient.PadSpread.
-
- \list
- \li ShapeGradient.PadSpread - The area is filled with the closest stop color.
- \li ShapeGradient.RepeatSpread - The gradient is repeated outside the gradient area.
- \li ShapeGradient.ReflectSpread - The gradient is reflected outside the gradient area.
- \endlist
- */
-
-QQuickShapeGradient::SpreadMode QQuickShapeGradient::spread() const
-{
- return m_spread;
-}
-
-void QQuickShapeGradient::setSpread(SpreadMode mode)
-{
- if (m_spread != mode) {
- m_spread = mode;
- emit spreadChanged();
- emit updated();
- }
-}
-
-/*!
- \qmltype LinearGradient
- \instantiates QQuickShapeLinearGradient
- \inqmlmodule QtQuick.Shapes
- \ingroup qtquick-paths
- \ingroup qtquick-views
- \inherits ShapeGradient
- \brief Linear gradient
- \since 5.10
-
- Linear gradients interpolate colors between start and end points. Outside
- these points the gradient is either padded, reflected or repeated depending
- on the spread type.
-
- \note LinearGradient is not compatible with Rectangle items that only
- support Gradient. This type is to be used with Shape.
-
- \sa QLinearGradient
- */
-
-QQuickShapeLinearGradient::QQuickShapeLinearGradient(QObject *parent)
- : QQuickShapeGradient(parent)
-{
-}
-
-/*!
- \qmlproperty real QtQuick.Shapes::LinearGradient::x1
- \qmlproperty real QtQuick.Shapes::LinearGradient::y1
- \qmlproperty real QtQuick.Shapes::LinearGradient::x2
- \qmlproperty real QtQuick.Shapes::LinearGradient::y2
-
- These properties define the start and end points between which color
- interpolation occurs. By default both the stard and end points are set to
- (0, 0).
- */
-
-qreal QQuickShapeLinearGradient::x1() const
-{
- return m_start.x();
-}
-
-void QQuickShapeLinearGradient::setX1(qreal v)
-{
- if (m_start.x() != v) {
- m_start.setX(v);
- emit x1Changed();
- emit updated();
- }
-}
-
-qreal QQuickShapeLinearGradient::y1() const
-{
- return m_start.y();
-}
-
-void QQuickShapeLinearGradient::setY1(qreal v)
-{
- if (m_start.y() != v) {
- m_start.setY(v);
- emit y1Changed();
- emit updated();
- }
-}
-
-qreal QQuickShapeLinearGradient::x2() const
-{
- return m_end.x();
-}
-
-void QQuickShapeLinearGradient::setX2(qreal v)
-{
- if (m_end.x() != v) {
- m_end.setX(v);
- emit x2Changed();
- emit updated();
- }
-}
-
-qreal QQuickShapeLinearGradient::y2() const
-{
- return m_end.y();
-}
-
-void QQuickShapeLinearGradient::setY2(qreal v)
-{
- if (m_end.y() != v) {
- m_end.setY(v);
- emit y2Changed();
- emit updated();
- }
-}
-
-#ifndef QT_NO_OPENGL
-
-// contexts sharing with each other get the same cache instance
-class QQuickShapeGradientCacheWrapper
-{
-public:
- QQuickShapeGradientCache *get(QOpenGLContext *context)
- {
- return m_resource.value<QQuickShapeGradientCache>(context);
- }
-
-private:
- QOpenGLMultiGroupSharedResource m_resource;
-};
-
-QQuickShapeGradientCache *QQuickShapeGradientCache::currentCache()
-{
- static QQuickShapeGradientCacheWrapper qt_path_gradient_caches;
- return qt_path_gradient_caches.get(QOpenGLContext::currentContext());
-}
-
-// let QOpenGLContext manage the lifetime of the cached textures
-QQuickShapeGradientCache::~QQuickShapeGradientCache()
-{
- m_cache.clear();
-}
-
-void QQuickShapeGradientCache::invalidateResource()
-{
- m_cache.clear();
-}
-
-void QQuickShapeGradientCache::freeResource(QOpenGLContext *)
-{
- qDeleteAll(m_cache);
- m_cache.clear();
-}
-
-static void generateGradientColorTable(const QQuickShapeGradientCache::GradientDesc &gradient,
- uint *colorTable, int size, float opacity)
-{
- int pos = 0;
- const QGradientStops &s = gradient.stops;
- const bool colorInterpolation = true;
-
- uint alpha = qRound(opacity * 256);
- uint current_color = ARGB_COMBINE_ALPHA(s[0].second.rgba(), alpha);
- qreal incr = 1.0 / qreal(size);
- qreal fpos = 1.5 * incr;
- colorTable[pos++] = ARGB2RGBA(qPremultiply(current_color));
-
- while (fpos <= s.first().first) {
- colorTable[pos] = colorTable[pos - 1];
- pos++;
- fpos += incr;
- }
-
- if (colorInterpolation)
- current_color = qPremultiply(current_color);
-
- const int sLast = s.size() - 1;
- for (int i = 0; i < sLast; ++i) {
- qreal delta = 1/(s[i+1].first - s[i].first);
- uint next_color = ARGB_COMBINE_ALPHA(s[i + 1].second.rgba(), alpha);
- if (colorInterpolation)
- next_color = qPremultiply(next_color);
-
- while (fpos < s[i+1].first && pos < size) {
- int dist = int(256 * ((fpos - s[i].first) * delta));
- int idist = 256 - dist;
- if (colorInterpolation)
- colorTable[pos] = ARGB2RGBA(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist));
- else
- colorTable[pos] = ARGB2RGBA(qPremultiply(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist)));
- ++pos;
- fpos += incr;
- }
- current_color = next_color;
- }
-
- Q_ASSERT(s.size() > 0);
-
- uint last_color = ARGB2RGBA(qPremultiply(ARGB_COMBINE_ALPHA(s[sLast].second.rgba(), alpha)));
- for ( ; pos < size; ++pos)
- colorTable[pos] = last_color;
-
- colorTable[size-1] = last_color;
-}
-
-QSGTexture *QQuickShapeGradientCache::get(const GradientDesc &grad)
-{
- QSGPlainTexture *tx = m_cache[grad];
- if (!tx) {
- QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
- GLuint id;
- f->glGenTextures(1, &id);
- f->glBindTexture(GL_TEXTURE_2D, id);
- static const uint W = 1024; // texture size is 1024x1
- uint buf[W];
- generateGradientColorTable(grad, buf, W, 1.0f);
- f->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, W, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf);
- tx = new QSGPlainTexture;
- tx->setTextureId(id);
- switch (grad.spread) {
- case QQuickShapeGradient::PadSpread:
- tx->setHorizontalWrapMode(QSGTexture::ClampToEdge);
- tx->setVerticalWrapMode(QSGTexture::ClampToEdge);
- break;
- case QQuickShapeGradient::RepeatSpread:
- tx->setHorizontalWrapMode(QSGTexture::Repeat);
- tx->setVerticalWrapMode(QSGTexture::Repeat);
- break;
- case QQuickShapeGradient::ReflectSpread:
- tx->setHorizontalWrapMode(QSGTexture::MirroredRepeat);
- tx->setVerticalWrapMode(QSGTexture::MirroredRepeat);
- break;
- default:
- qWarning("Unknown gradient spread mode %d", grad.spread);
- break;
- }
- m_cache[grad] = tx;
- }
- return tx;
-}
-
-#endif // QT_NO_OPENGL
-
-QT_END_NAMESPACE
-
-#include "moc_qquickshape_p.cpp"
diff --git a/src/imports/shapes/qquickshape_p.h b/src/imports/shapes/qquickshape_p.h
deleted file mode 100644
index db0b449c6c..0000000000
--- a/src/imports/shapes/qquickshape_p.h
+++ /dev/null
@@ -1,287 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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 QQUICKSHAPE_P_H
-#define QQUICKSHAPE_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 "qquickitem.h"
-
-#include <private/qtquickglobal_p.h>
-#include <private/qquickpath_p_p.h>
-#include <private/qquickrectangle_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickShapePathPrivate;
-class QQuickShapePrivate;
-
-class QQuickShapeGradient : public QQuickGradient
-{
- Q_OBJECT
- Q_PROPERTY(SpreadMode spread READ spread WRITE setSpread NOTIFY spreadChanged)
- Q_CLASSINFO("DefaultProperty", "stops")
-
-public:
- enum SpreadMode {
- PadSpread,
- RepeatSpread,
- ReflectSpread
- };
- Q_ENUM(SpreadMode)
-
- QQuickShapeGradient(QObject *parent = nullptr);
-
- SpreadMode spread() const;
- void setSpread(SpreadMode mode);
-
-signals:
- void spreadChanged();
-
-private:
- SpreadMode m_spread;
-};
-
-class QQuickShapeLinearGradient : public QQuickShapeGradient
-{
- Q_OBJECT
- Q_PROPERTY(qreal x1 READ x1 WRITE setX1 NOTIFY x1Changed)
- Q_PROPERTY(qreal y1 READ y1 WRITE setY1 NOTIFY y1Changed)
- Q_PROPERTY(qreal x2 READ x2 WRITE setX2 NOTIFY x2Changed)
- Q_PROPERTY(qreal y2 READ y2 WRITE setY2 NOTIFY y2Changed)
- Q_CLASSINFO("DefaultProperty", "stops")
-
-public:
- QQuickShapeLinearGradient(QObject *parent = nullptr);
-
- qreal x1() const;
- void setX1(qreal v);
- qreal y1() const;
- void setY1(qreal v);
- qreal x2() const;
- void setX2(qreal v);
- qreal y2() const;
- void setY2(qreal v);
-
-signals:
- void x1Changed();
- void y1Changed();
- void x2Changed();
- void y2Changed();
-
-private:
- QPointF m_start;
- QPointF m_end;
-};
-
-class QQuickShapePath : public QQuickPath
-{
- Q_OBJECT
-
- Q_PROPERTY(QColor strokeColor READ strokeColor WRITE setStrokeColor NOTIFY strokeColorChanged)
- Q_PROPERTY(qreal strokeWidth READ strokeWidth WRITE setStrokeWidth NOTIFY strokeWidthChanged)
- Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged)
- Q_PROPERTY(FillRule fillRule READ fillRule WRITE setFillRule NOTIFY fillRuleChanged)
- Q_PROPERTY(JoinStyle joinStyle READ joinStyle WRITE setJoinStyle NOTIFY joinStyleChanged)
- Q_PROPERTY(int miterLimit READ miterLimit WRITE setMiterLimit NOTIFY miterLimitChanged)
- Q_PROPERTY(CapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged)
- Q_PROPERTY(StrokeStyle strokeStyle READ strokeStyle WRITE setStrokeStyle NOTIFY strokeStyleChanged)
- Q_PROPERTY(qreal dashOffset READ dashOffset WRITE setDashOffset NOTIFY dashOffsetChanged)
- Q_PROPERTY(QVector<qreal> dashPattern READ dashPattern WRITE setDashPattern NOTIFY dashPatternChanged)
- Q_PROPERTY(QQuickShapeGradient *fillGradient READ fillGradient WRITE setFillGradient RESET resetFillGradient)
-
-public:
- enum FillRule {
- OddEvenFill = Qt::OddEvenFill,
- WindingFill = Qt::WindingFill
- };
- Q_ENUM(FillRule)
-
- enum JoinStyle {
- MiterJoin = Qt::MiterJoin,
- BevelJoin = Qt::BevelJoin,
- RoundJoin = Qt::RoundJoin
- };
- Q_ENUM(JoinStyle)
-
- enum CapStyle {
- FlatCap = Qt::FlatCap,
- SquareCap = Qt::SquareCap,
- RoundCap = Qt::RoundCap
- };
- Q_ENUM(CapStyle)
-
- enum StrokeStyle {
- SolidLine = Qt::SolidLine,
- DashLine = Qt::DashLine
- };
- Q_ENUM(StrokeStyle)
-
- QQuickShapePath(QObject *parent = nullptr);
- ~QQuickShapePath();
-
- QColor strokeColor() const;
- void setStrokeColor(const QColor &color);
-
- qreal strokeWidth() const;
- void setStrokeWidth(qreal w);
-
- QColor fillColor() const;
- void setFillColor(const QColor &color);
-
- FillRule fillRule() const;
- void setFillRule(FillRule fillRule);
-
- JoinStyle joinStyle() const;
- void setJoinStyle(JoinStyle style);
-
- int miterLimit() const;
- void setMiterLimit(int limit);
-
- CapStyle capStyle() const;
- void setCapStyle(CapStyle style);
-
- StrokeStyle strokeStyle() const;
- void setStrokeStyle(StrokeStyle style);
-
- qreal dashOffset() const;
- void setDashOffset(qreal offset);
-
- QVector<qreal> dashPattern() const;
- void setDashPattern(const QVector<qreal> &array);
-
- QQuickShapeGradient *fillGradient() const;
- void setFillGradient(QQuickShapeGradient *gradient);
- void resetFillGradient();
-
-Q_SIGNALS:
- void shapePathChanged();
- void strokeColorChanged();
- void strokeWidthChanged();
- void fillColorChanged();
- void fillRuleChanged();
- void joinStyleChanged();
- void miterLimitChanged();
- void capStyleChanged();
- void strokeStyleChanged();
- void dashOffsetChanged();
- void dashPatternChanged();
- void fillGradientChanged();
-
-private:
- Q_DISABLE_COPY(QQuickShapePath)
- Q_DECLARE_PRIVATE(QQuickShapePath)
- Q_PRIVATE_SLOT(d_func(), void _q_fillGradientChanged())
-};
-
-class QQuickShape : public QQuickItem
-{
- Q_OBJECT
- Q_PROPERTY(RendererType renderer READ rendererType NOTIFY rendererChanged)
- Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged)
- Q_PROPERTY(bool vendorExtensionsEnabled READ vendorExtensionsEnabled WRITE setVendorExtensionsEnabled NOTIFY vendorExtensionsEnabledChanged)
- Q_PROPERTY(Status status READ status NOTIFY statusChanged)
- Q_PROPERTY(QQmlListProperty<QObject> data READ data)
- Q_CLASSINFO("DefaultProperty", "data")
-
-public:
- enum RendererType {
- UnknownRenderer,
- GeometryRenderer,
- NvprRenderer,
- SoftwareRenderer
- };
- Q_ENUM(RendererType)
-
- enum Status {
- Null,
- Ready,
- Processing
- };
- Q_ENUM(Status)
-
- QQuickShape(QQuickItem *parent = nullptr);
- ~QQuickShape();
-
- RendererType rendererType() const;
-
- bool asynchronous() const;
- void setAsynchronous(bool async);
-
- bool vendorExtensionsEnabled() const;
- void setVendorExtensionsEnabled(bool enable);
-
- Status status() const;
-
- QQmlListProperty<QObject> data();
-
-protected:
- QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *) override;
- void updatePolish() override;
- void itemChange(ItemChange change, const ItemChangeData &data) override;
- void componentComplete() override;
- void classBegin() override;
-
-Q_SIGNALS:
- void rendererChanged();
- void asynchronousChanged();
- void vendorExtensionsEnabledChanged();
- void statusChanged();
-
-private:
- Q_DISABLE_COPY(QQuickShape)
- Q_DECLARE_PRIVATE(QQuickShape)
- Q_PRIVATE_SLOT(d_func(), void _q_shapePathChanged())
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickShape)
-
-#endif // QQUICKSHAPE_P_H
diff --git a/src/imports/shapes/qquickshape_p_p.h b/src/imports/shapes/qquickshape_p_p.h
deleted file mode 100644
index a8a5675ccb..0000000000
--- a/src/imports/shapes/qquickshape_p_p.h
+++ /dev/null
@@ -1,281 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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 QQUICKSHAPE_P_P_H
-#define QQUICKSHAPE_P_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 "qquickshape_p.h"
-#include <QtQuick/private/qquickitem_p.h>
-#include <QPainterPath>
-#include <QColor>
-#include <QBrush>
-#include <private/qopenglcontext_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSGPlainTexture;
-
-struct QQuickShapePathCommands
-{
- enum Command {
- MoveTo,
- LineTo,
- QuadTo,
- CubicTo,
- ArcTo
- };
-
- QVector<Command> cmd;
- QVector<float> coords;
-
- QPainterPath toPainterPath() const;
-};
-
-struct QQuickShapeStrokeFillParams
-{
- QQuickShapeStrokeFillParams();
-
- QColor strokeColor;
- qreal strokeWidth;
- QColor fillColor;
- QQuickShapePath::FillRule fillRule;
- QQuickShapePath::JoinStyle joinStyle;
- int miterLimit;
- QQuickShapePath::CapStyle capStyle;
- QQuickShapePath::StrokeStyle strokeStyle;
- qreal dashOffset;
- QVector<qreal> dashPattern;
- QQuickShapeGradient *fillGradient;
-};
-
-class QQuickAbstractPathRenderer
-{
-public:
- enum Flag {
- SupportsAsync = 0x01
- };
- Q_DECLARE_FLAGS(Flags, Flag)
-
- virtual ~QQuickAbstractPathRenderer() { }
-
- // Gui thread
- virtual void beginSync(int totalCount) = 0;
- virtual void endSync(bool async) = 0;
- virtual void setAsyncCallback(void (*)(void *), void *) { }
- virtual Flags flags() const { return 0; }
- // - QML API
- virtual void setPath(int index, const QQuickPath *path) = 0;
- // - JS API
- virtual void setJSPath(int index, const QQuickShapePathCommands &path) = 0;
- // - stroke/fill parameters
- virtual void setStrokeColor(int index, const QColor &color) = 0;
- virtual void setStrokeWidth(int index, qreal w) = 0;
- virtual void setFillColor(int index, const QColor &color) = 0;
- virtual void setFillRule(int index, QQuickShapePath::FillRule fillRule) = 0;
- virtual void setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit) = 0;
- virtual void setCapStyle(int index, QQuickShapePath::CapStyle capStyle) = 0;
- virtual void setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle,
- qreal dashOffset, const QVector<qreal> &dashPattern) = 0;
- virtual void setFillGradient(int index, QQuickShapeGradient *gradient) = 0;
-
- // Render thread, with gui blocked
- virtual void updateNode() = 0;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickAbstractPathRenderer::Flags)
-
-class QQuickShapePathPrivate : public QQuickPathPrivate
-{
- Q_DECLARE_PUBLIC(QQuickShapePath)
-
-public:
- enum Dirty {
- DirtyPath = 0x01,
- DirtyStrokeColor = 0x02,
- DirtyStrokeWidth = 0x04,
- DirtyFillColor = 0x08,
- DirtyFillRule = 0x10,
- DirtyStyle = 0x20,
- DirtyDash = 0x40,
- DirtyFillGradient = 0x80,
-
- DirtyAll = 0xFF
- };
-
- QQuickShapePathPrivate();
-
- void _q_pathChanged();
- void _q_fillGradientChanged();
-
- static QQuickShapePathPrivate *get(QQuickShapePath *p) { return p->d_func(); }
-
- int dirty;
- QQuickShapeStrokeFillParams sfp;
-};
-
-class QQuickShapePrivate : public QQuickItemPrivate
-{
- Q_DECLARE_PUBLIC(QQuickShape)
-
-public:
- QQuickShapePrivate();
- ~QQuickShapePrivate();
-
- void createRenderer();
- QSGNode *createNode();
- void sync();
-
- void _q_shapePathChanged();
- void setStatus(QQuickShape::Status newStatus);
-
- static QQuickShapePrivate *get(QQuickShape *item) { return item->d_func(); }
-
- bool componentComplete;
- bool spChanged;
- QQuickShape::RendererType rendererType;
- bool async;
- QQuickShape::Status status;
- QQuickAbstractPathRenderer *renderer;
-
- struct {
- QVector<QQuickShapePath *> sp;
- } qmlData;
-
- struct {
- bool isValid() const { Q_ASSERT(paths.count() == sfp.count()); return !paths.isEmpty(); }
- QVector<QQuickShapePathCommands> paths;
- QVector<QQuickShapeStrokeFillParams> sfp;
- } jsData;
-
- bool enableVendorExts;
-};
-
-class QQuickShapePathObject : public QObject
-{
- Q_OBJECT
-
-public:
- QQuickShapePathObject(QObject *parent = nullptr) : QObject(parent) { }
-
- void setV4Engine(QV4::ExecutionEngine *engine);
- QV4::ReturnedValue v4value() const { return m_v4value.value(); }
-
- QQuickShapePath path;
-
- void clear();
-
-private:
- QV4::PersistentValue m_v4value;
-};
-
-class QQuickShapeStrokeFillParamsObject : public QObject
-{
- Q_OBJECT
-
-public:
- QQuickShapeStrokeFillParamsObject(QObject *parent = nullptr) : QObject(parent) { }
-
- void setV4Engine(QV4::ExecutionEngine *engine);
- QV4::ReturnedValue v4value() const { return m_v4value.value(); }
-
- QQuickShapeStrokeFillParams sfp;
- QV4::PersistentValue v4fillGradient;
-
- void clear();
-
-private:
- QV4::PersistentValue m_v4value;
-};
-
-#ifndef QT_NO_OPENGL
-
-class QQuickShapeGradientCache : public QOpenGLSharedResource
-{
-public:
- struct GradientDesc {
- QGradientStops stops;
- QPointF start;
- QPointF end;
- QQuickShapeGradient::SpreadMode spread;
- bool operator==(const GradientDesc &other) const
- {
- return start == other.start && end == other.end && spread == other.spread
- && stops == other.stops;
- }
- };
-
- QQuickShapeGradientCache(QOpenGLContext *context) : QOpenGLSharedResource(context->shareGroup()) { }
- ~QQuickShapeGradientCache();
-
- void invalidateResource() override;
- void freeResource(QOpenGLContext *) override;
-
- QSGTexture *get(const GradientDesc &grad);
-
- static QQuickShapeGradientCache *currentCache();
-
-private:
- QHash<GradientDesc, QSGPlainTexture *> m_cache;
-};
-
-inline uint qHash(const QQuickShapeGradientCache::GradientDesc &v, uint seed = 0)
-{
- uint h = seed;
- h += v.start.x() + v.end.y() + v.spread;
- for (int i = 0; i < 3 && i < v.stops.count(); ++i)
- h += v.stops[i].second.rgba();
- return h;
-}
-
-#endif // QT_NO_OPENGL
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/imports/shapes/qquickshapegenericrenderer.cpp b/src/imports/shapes/qquickshapegenericrenderer.cpp
deleted file mode 100644
index 47203698d5..0000000000
--- a/src/imports/shapes/qquickshapegenericrenderer.cpp
+++ /dev/null
@@ -1,775 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qquickshapegenericrenderer_p.h"
-#include <QtGui/private/qtriangulator_p.h>
-#include <QtGui/private/qtriangulatingstroker_p.h>
-#include <QThreadPool>
-
-#ifndef QT_NO_OPENGL
-#include <QSGVertexColorMaterial>
-#include <QOpenGLContext>
-#include <QOffscreenSurface>
-#include <QtGui/private/qopenglextensions_p.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-static const qreal TRI_SCALE = 1;
-
-struct ColoredVertex // must match QSGGeometry::ColoredPoint2D
-{
- float x, y;
- QQuickShapeGenericRenderer::Color4ub color;
- void set(float nx, float ny, QQuickShapeGenericRenderer::Color4ub ncolor)
- {
- x = nx; y = ny; color = ncolor;
- }
-};
-
-static inline QQuickShapeGenericRenderer::Color4ub colorToColor4ub(const QColor &c)
-{
- QQuickShapeGenericRenderer::Color4ub color = {
- uchar(qRound(c.redF() * c.alphaF() * 255)),
- uchar(qRound(c.greenF() * c.alphaF() * 255)),
- uchar(qRound(c.blueF() * c.alphaF() * 255)),
- uchar(qRound(c.alphaF() * 255))
- };
- return color;
-}
-
-QQuickShapeGenericStrokeFillNode::QQuickShapeGenericStrokeFillNode(QQuickWindow *window)
- : m_geometry(new QSGGeometry(QSGGeometry::defaultAttributes_ColoredPoint2D(), 0, 0)),
- m_window(window),
- m_material(nullptr)
-{
- setGeometry(m_geometry);
- activateMaterial(MatSolidColor);
-#ifdef QSG_RUNTIME_DESCRIPTION
- qsgnode_set_description(this, QLatin1String("stroke-fill"));
-#endif
-}
-
-QQuickShapeGenericStrokeFillNode::~QQuickShapeGenericStrokeFillNode()
-{
- delete m_geometry;
-}
-
-void QQuickShapeGenericStrokeFillNode::activateMaterial(Material m)
-{
- switch (m) {
- case MatSolidColor:
- // Use vertexcolor material. Items with different colors remain batchable
- // this way, at the expense of having to provide per-vertex color values.
- if (!m_solidColorMaterial)
- m_solidColorMaterial.reset(QQuickShapeGenericMaterialFactory::createVertexColor(m_window));
- m_material = m_solidColorMaterial.data();
- break;
- case MatLinearGradient:
- if (!m_linearGradientMaterial)
- m_linearGradientMaterial.reset(QQuickShapeGenericMaterialFactory::createLinearGradient(m_window, this));
- m_material = m_linearGradientMaterial.data();
- break;
- default:
- qWarning("Unknown material %d", m);
- return;
- }
-
- if (material() != m_material)
- setMaterial(m_material);
-}
-
-static bool q_supportsElementIndexUint(QSGRendererInterface::GraphicsApi api)
-{
- static bool elementIndexUint = true;
-#ifndef QT_NO_OPENGL
- if (api == QSGRendererInterface::OpenGL) {
- static bool elementIndexUintChecked = false;
- if (!elementIndexUintChecked) {
- elementIndexUintChecked = true;
- QOpenGLContext *context = QOpenGLContext::currentContext();
- QScopedPointer<QOpenGLContext> dummyContext;
- QScopedPointer<QOffscreenSurface> dummySurface;
- bool ok = true;
- if (!context) {
- dummyContext.reset(new QOpenGLContext);
- dummyContext->create();
- context = dummyContext.data();
- dummySurface.reset(new QOffscreenSurface);
- dummySurface->setFormat(context->format());
- dummySurface->create();
- ok = context->makeCurrent(dummySurface.data());
- }
- if (ok) {
- elementIndexUint = static_cast<QOpenGLExtensions *>(context->functions())->hasOpenGLExtension(
- QOpenGLExtensions::ElementIndexUint);
- }
- }
- }
-#else
- Q_UNUSED(api);
-#endif
- return elementIndexUint;
-}
-
-QQuickShapeGenericRenderer::~QQuickShapeGenericRenderer()
-{
- for (ShapePathData &d : m_sp) {
- if (d.pendingFill)
- d.pendingFill->orphaned = true;
- if (d.pendingStroke)
- d.pendingStroke->orphaned = true;
- }
-}
-
-// sync, and so triangulation too, happens on the gui thread
-// - except when async is set, in which case triangulation is moved to worker threads
-
-void QQuickShapeGenericRenderer::beginSync(int totalCount)
-{
- if (m_sp.count() != totalCount) {
- m_sp.resize(totalCount);
- m_accDirty |= DirtyList;
- }
- for (ShapePathData &d : m_sp)
- d.syncDirty = 0;
-}
-
-void QQuickShapeGenericRenderer::setPath(int index, const QQuickPath *path)
-{
- ShapePathData &d(m_sp[index]);
- d.path = path ? path->path() : QPainterPath();
- d.syncDirty |= DirtyFillGeom | DirtyStrokeGeom;
-}
-
-void QQuickShapeGenericRenderer::setJSPath(int index, const QQuickShapePathCommands &path)
-{
- ShapePathData &d(m_sp[index]);
- d.path = path.toPainterPath();
- d.syncDirty |= DirtyFillGeom | DirtyStrokeGeom;
-}
-
-void QQuickShapeGenericRenderer::setStrokeColor(int index, const QColor &color)
-{
- ShapePathData &d(m_sp[index]);
- d.strokeColor = colorToColor4ub(color);
- d.syncDirty |= DirtyColor;
-}
-
-void QQuickShapeGenericRenderer::setStrokeWidth(int index, qreal w)
-{
- ShapePathData &d(m_sp[index]);
- d.strokeWidth = w;
- if (w >= 0.0f)
- d.pen.setWidthF(w);
- d.syncDirty |= DirtyStrokeGeom;
-}
-
-void QQuickShapeGenericRenderer::setFillColor(int index, const QColor &color)
-{
- ShapePathData &d(m_sp[index]);
- d.fillColor = colorToColor4ub(color);
- d.syncDirty |= DirtyColor;
-}
-
-void QQuickShapeGenericRenderer::setFillRule(int index, QQuickShapePath::FillRule fillRule)
-{
- ShapePathData &d(m_sp[index]);
- d.fillRule = Qt::FillRule(fillRule);
- d.syncDirty |= DirtyFillGeom;
-}
-
-void QQuickShapeGenericRenderer::setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit)
-{
- ShapePathData &d(m_sp[index]);
- d.pen.setJoinStyle(Qt::PenJoinStyle(joinStyle));
- d.pen.setMiterLimit(miterLimit);
- d.syncDirty |= DirtyStrokeGeom;
-}
-
-void QQuickShapeGenericRenderer::setCapStyle(int index, QQuickShapePath::CapStyle capStyle)
-{
- ShapePathData &d(m_sp[index]);
- d.pen.setCapStyle(Qt::PenCapStyle(capStyle));
- d.syncDirty |= DirtyStrokeGeom;
-}
-
-void QQuickShapeGenericRenderer::setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle,
- qreal dashOffset, const QVector<qreal> &dashPattern)
-{
- ShapePathData &d(m_sp[index]);
- d.pen.setStyle(Qt::PenStyle(strokeStyle));
- if (strokeStyle == QQuickShapePath::DashLine) {
- d.pen.setDashPattern(dashPattern);
- d.pen.setDashOffset(dashOffset);
- }
- d.syncDirty |= DirtyStrokeGeom;
-}
-
-void QQuickShapeGenericRenderer::setFillGradient(int index, QQuickShapeGradient *gradient)
-{
- ShapePathData &d(m_sp[index]);
- d.fillGradientActive = gradient != nullptr;
- if (gradient) {
- d.fillGradient.stops = gradient->gradientStops(); // sorted
- d.fillGradient.spread = gradient->spread();
- if (QQuickShapeLinearGradient *g = qobject_cast<QQuickShapeLinearGradient *>(gradient)) {
- d.fillGradient.start = QPointF(g->x1(), g->y1());
- d.fillGradient.end = QPointF(g->x2(), g->y2());
- } else {
- Q_UNREACHABLE();
- }
- }
- d.syncDirty |= DirtyFillGradient;
-}
-
-void QQuickShapeFillRunnable::run()
-{
- QQuickShapeGenericRenderer::triangulateFill(path, fillColor, &fillVertices, &fillIndices, &indexType, supportsElementIndexUint);
- emit done(this);
-}
-
-void QQuickShapeStrokeRunnable::run()
-{
- QQuickShapeGenericRenderer::triangulateStroke(path, pen, strokeColor, &strokeVertices, clipSize);
- emit done(this);
-}
-
-void QQuickShapeGenericRenderer::setAsyncCallback(void (*callback)(void *), void *data)
-{
- m_asyncCallback = callback;
- m_asyncCallbackData = data;
-}
-
-static QThreadPool *pathWorkThreadPool = nullptr;
-
-static void deletePathWorkThreadPool()
-{
- delete pathWorkThreadPool;
- pathWorkThreadPool = nullptr;
-}
-
-void QQuickShapeGenericRenderer::endSync(bool async)
-{
- bool didKickOffAsync = false;
-
- for (int i = 0; i < m_sp.count(); ++i) {
- ShapePathData &d(m_sp[i]);
- if (!d.syncDirty)
- continue;
-
- m_accDirty |= d.syncDirty;
-
- // Use a shadow dirty flag in order to avoid losing state in case there are
- // multiple syncs with different dirty flags before we get to updateNode()
- // on the render thread (with the gui thread blocked). For our purposes
- // here syncDirty is still required since geometry regeneration must only
- // happen when there was an actual change in this particular sync round.
- d.effectiveDirty |= d.syncDirty;
-
- if (d.path.isEmpty()) {
- d.fillVertices.clear();
- d.fillIndices.clear();
- d.strokeVertices.clear();
- continue;
- }
-
- if (async && !pathWorkThreadPool) {
- qAddPostRoutine(deletePathWorkThreadPool);
- pathWorkThreadPool = new QThreadPool;
- const int idealCount = QThread::idealThreadCount();
- pathWorkThreadPool->setMaxThreadCount(idealCount > 0 ? idealCount * 2 : 4);
- }
-
- if ((d.syncDirty & DirtyFillGeom) && d.fillColor.a) {
- d.path.setFillRule(d.fillRule);
- if (m_api == QSGRendererInterface::Unknown)
- m_api = m_item->window()->rendererInterface()->graphicsApi();
- if (async) {
- QQuickShapeFillRunnable *r = new QQuickShapeFillRunnable;
- r->setAutoDelete(false);
- if (d.pendingFill)
- d.pendingFill->orphaned = true;
- d.pendingFill = r;
- r->path = d.path;
- r->fillColor = d.fillColor;
- r->supportsElementIndexUint = q_supportsElementIndexUint(m_api);
- // Unlikely in practice but in theory m_sp could be
- // resized. Therefore, capture 'i' instead of 'd'.
- QObject::connect(r, &QQuickShapeFillRunnable::done, qApp, [this, i](QQuickShapeFillRunnable *r) {
- // Bail out when orphaned (meaning either another run was
- // started after this one, or the renderer got destroyed).
- if (!r->orphaned && i < m_sp.count()) {
- ShapePathData &d(m_sp[i]);
- d.fillVertices = r->fillVertices;
- d.fillIndices = r->fillIndices;
- d.indexType = r->indexType;
- d.pendingFill = nullptr;
- d.effectiveDirty |= DirtyFillGeom;
- maybeUpdateAsyncItem();
- }
- r->deleteLater();
- });
- didKickOffAsync = true;
- pathWorkThreadPool->start(r);
- } else {
- triangulateFill(d.path, d.fillColor, &d.fillVertices, &d.fillIndices, &d.indexType, q_supportsElementIndexUint(m_api));
- }
- }
-
- if ((d.syncDirty & DirtyStrokeGeom) && d.strokeWidth >= 0.0f && d.strokeColor.a) {
- if (async) {
- QQuickShapeStrokeRunnable *r = new QQuickShapeStrokeRunnable;
- r->setAutoDelete(false);
- if (d.pendingStroke)
- d.pendingStroke->orphaned = true;
- d.pendingStroke = r;
- r->path = d.path;
- r->pen = d.pen;
- r->strokeColor = d.strokeColor;
- r->clipSize = QSize(m_item->width(), m_item->height());
- QObject::connect(r, &QQuickShapeStrokeRunnable::done, qApp, [this, i](QQuickShapeStrokeRunnable *r) {
- if (!r->orphaned && i < m_sp.count()) {
- ShapePathData &d(m_sp[i]);
- d.strokeVertices = r->strokeVertices;
- d.pendingStroke = nullptr;
- d.effectiveDirty |= DirtyStrokeGeom;
- maybeUpdateAsyncItem();
- }
- r->deleteLater();
- });
- didKickOffAsync = true;
- pathWorkThreadPool->start(r);
- } else {
- triangulateStroke(d.path, d.pen, d.strokeColor, &d.strokeVertices,
- QSize(m_item->width(), m_item->height()));
- }
- }
- }
-
- if (!didKickOffAsync && async && m_asyncCallback)
- m_asyncCallback(m_asyncCallbackData);
-}
-
-void QQuickShapeGenericRenderer::maybeUpdateAsyncItem()
-{
- for (const ShapePathData &d : qAsConst(m_sp)) {
- if (d.pendingFill || d.pendingStroke)
- return;
- }
- m_accDirty |= DirtyFillGeom | DirtyStrokeGeom;
- m_item->update();
- if (m_asyncCallback)
- m_asyncCallback(m_asyncCallbackData);
-}
-
-// the stroke/fill triangulation functions may be invoked either on the gui
-// thread or some worker thread and must thus be self-contained.
-void QQuickShapeGenericRenderer::triangulateFill(const QPainterPath &path,
- const Color4ub &fillColor,
- VertexContainerType *fillVertices,
- IndexContainerType *fillIndices,
- QSGGeometry::Type *indexType,
- bool supportsElementIndexUint)
-{
- const QVectorPath &vp = qtVectorPathForPath(path);
-
- QTriangleSet ts = qTriangulate(vp, QTransform::fromScale(TRI_SCALE, TRI_SCALE), 1, supportsElementIndexUint);
- const int vertexCount = ts.vertices.count() / 2; // just a qreal vector with x,y hence the / 2
- fillVertices->resize(vertexCount);
- ColoredVertex *vdst = reinterpret_cast<ColoredVertex *>(fillVertices->data());
- const qreal *vsrc = ts.vertices.constData();
- for (int i = 0; i < vertexCount; ++i)
- vdst[i].set(vsrc[i * 2] / TRI_SCALE, vsrc[i * 2 + 1] / TRI_SCALE, fillColor);
-
- size_t indexByteSize;
- if (ts.indices.type() == QVertexIndexVector::UnsignedShort) {
- *indexType = QSGGeometry::UnsignedShortType;
- // fillIndices is still QVector<quint32>. Just resize to N/2 and pack
- // the N quint16s into it.
- fillIndices->resize(ts.indices.size() / 2);
- indexByteSize = ts.indices.size() * sizeof(quint16);
- } else {
- *indexType = QSGGeometry::UnsignedIntType;
- fillIndices->resize(ts.indices.size());
- indexByteSize = ts.indices.size() * sizeof(quint32);
- }
- memcpy(fillIndices->data(), ts.indices.data(), indexByteSize);
-}
-
-void QQuickShapeGenericRenderer::triangulateStroke(const QPainterPath &path,
- const QPen &pen,
- const Color4ub &strokeColor,
- VertexContainerType *strokeVertices,
- const QSize &clipSize)
-{
- const QVectorPath &vp = qtVectorPathForPath(path);
- const QRectF clip(QPointF(0, 0), clipSize);
- const qreal inverseScale = 1.0 / TRI_SCALE;
-
- QTriangulatingStroker stroker;
- stroker.setInvScale(inverseScale);
-
- if (pen.style() == Qt::SolidLine) {
- stroker.process(vp, pen, clip, 0);
- } else {
- QDashedStrokeProcessor dashStroker;
- dashStroker.setInvScale(inverseScale);
- dashStroker.process(vp, pen, clip, 0);
- QVectorPath dashStroke(dashStroker.points(), dashStroker.elementCount(),
- dashStroker.elementTypes(), 0);
- stroker.process(dashStroke, pen, clip, 0);
- }
-
- if (!stroker.vertexCount()) {
- strokeVertices->clear();
- return;
- }
-
- const int vertexCount = stroker.vertexCount() / 2; // just a float vector with x,y hence the / 2
- strokeVertices->resize(vertexCount);
- ColoredVertex *vdst = reinterpret_cast<ColoredVertex *>(strokeVertices->data());
- const float *vsrc = stroker.vertices();
- for (int i = 0; i < vertexCount; ++i)
- vdst[i].set(vsrc[i * 2], vsrc[i * 2 + 1], strokeColor);
-}
-
-void QQuickShapeGenericRenderer::setRootNode(QQuickShapeGenericNode *node)
-{
- if (m_rootNode != node) {
- m_rootNode = node;
- m_accDirty |= DirtyList;
- }
-}
-
-// on the render thread with gui blocked
-void QQuickShapeGenericRenderer::updateNode()
-{
- if (!m_rootNode || !m_accDirty)
- return;
-
-// [ m_rootNode ]
-// / / /
-// #0 [ fill ] [ stroke ] [ next ]
-// / / |
-// #1 [ fill ] [ stroke ] [ next ]
-// / / |
-// #2 [ fill ] [ stroke ] [ next ]
-// ...
-// ...
-
- QQuickShapeGenericNode **nodePtr = &m_rootNode;
- QQuickShapeGenericNode *prevNode = nullptr;
-
- for (ShapePathData &d : m_sp) {
- if (!*nodePtr) {
- *nodePtr = new QQuickShapeGenericNode;
- prevNode->m_next = *nodePtr;
- prevNode->appendChildNode(*nodePtr);
- }
-
- QQuickShapeGenericNode *node = *nodePtr;
-
- if (m_accDirty & DirtyList)
- d.effectiveDirty |= DirtyFillGeom | DirtyStrokeGeom | DirtyColor | DirtyFillGradient;
-
- if (!d.effectiveDirty) {
- prevNode = node;
- nodePtr = &node->m_next;
- continue;
- }
-
- if (d.fillColor.a == 0) {
- delete node->m_fillNode;
- node->m_fillNode = nullptr;
- } else if (!node->m_fillNode) {
- node->m_fillNode = new QQuickShapeGenericStrokeFillNode(m_item->window());
- if (node->m_strokeNode)
- node->removeChildNode(node->m_strokeNode);
- node->appendChildNode(node->m_fillNode);
- if (node->m_strokeNode)
- node->appendChildNode(node->m_strokeNode);
- d.effectiveDirty |= DirtyFillGeom;
- }
-
- if (d.strokeWidth < 0.0f || d.strokeColor.a == 0) {
- delete node->m_strokeNode;
- node->m_strokeNode = nullptr;
- } else if (!node->m_strokeNode) {
- node->m_strokeNode = new QQuickShapeGenericStrokeFillNode(m_item->window());
- node->appendChildNode(node->m_strokeNode);
- d.effectiveDirty |= DirtyStrokeGeom;
- }
-
- updateFillNode(&d, node);
- updateStrokeNode(&d, node);
-
- d.effectiveDirty = 0;
-
- prevNode = node;
- nodePtr = &node->m_next;
- }
-
- if (*nodePtr && prevNode) {
- prevNode->removeChildNode(*nodePtr);
- delete *nodePtr;
- *nodePtr = nullptr;
- }
-
- m_accDirty = 0;
-}
-
-void QQuickShapeGenericRenderer::updateShadowDataInNode(ShapePathData *d, QQuickShapeGenericStrokeFillNode *n)
-{
- if (d->fillGradientActive) {
- if (d->effectiveDirty & DirtyFillGradient)
- n->m_fillGradient = d->fillGradient;
- }
-}
-
-void QQuickShapeGenericRenderer::updateFillNode(ShapePathData *d, QQuickShapeGenericNode *node)
-{
- if (!node->m_fillNode)
- return;
- if (!(d->effectiveDirty & (DirtyFillGeom | DirtyColor | DirtyFillGradient)))
- return;
-
- // Make a copy of the data that will be accessed by the material on
- // the render thread. This must be done even when we bail out below.
- QQuickShapeGenericStrokeFillNode *n = node->m_fillNode;
- updateShadowDataInNode(d, n);
-
- QSGGeometry *g = n->m_geometry;
- if (d->fillVertices.isEmpty()) {
- if (g->vertexCount() || g->indexCount()) {
- g->allocate(0, 0);
- n->markDirty(QSGNode::DirtyGeometry);
- }
- return;
- }
-
- if (d->fillGradientActive) {
- n->activateMaterial(QQuickShapeGenericStrokeFillNode::MatLinearGradient);
- if (d->effectiveDirty & DirtyFillGradient) {
- // Gradients are implemented via a texture-based material.
- n->markDirty(QSGNode::DirtyMaterial);
- // stop here if only the gradient changed; no need to touch the geometry
- if (!(d->effectiveDirty & DirtyFillGeom))
- return;
- }
- } else {
- n->activateMaterial(QQuickShapeGenericStrokeFillNode::MatSolidColor);
- // fast path for updating only color values when no change in vertex positions
- if ((d->effectiveDirty & DirtyColor) && !(d->effectiveDirty & DirtyFillGeom)) {
- ColoredVertex *vdst = reinterpret_cast<ColoredVertex *>(g->vertexData());
- for (int i = 0; i < g->vertexCount(); ++i)
- vdst[i].set(vdst[i].x, vdst[i].y, d->fillColor);
- n->markDirty(QSGNode::DirtyGeometry);
- return;
- }
- }
-
- const int indexCount = d->indexType == QSGGeometry::UnsignedShortType
- ? d->fillIndices.count() * 2 : d->fillIndices.count();
- if (g->indexType() != d->indexType) {
- g = new QSGGeometry(QSGGeometry::defaultAttributes_ColoredPoint2D(),
- d->fillVertices.count(), indexCount, d->indexType);
- n->setGeometry(g);
- delete n->m_geometry;
- n->m_geometry = g;
- } else {
- g->allocate(d->fillVertices.count(), indexCount);
- }
- g->setDrawingMode(QSGGeometry::DrawTriangles);
- memcpy(g->vertexData(), d->fillVertices.constData(), g->vertexCount() * g->sizeOfVertex());
- memcpy(g->indexData(), d->fillIndices.constData(), g->indexCount() * g->sizeOfIndex());
-
- n->markDirty(QSGNode::DirtyGeometry);
-}
-
-void QQuickShapeGenericRenderer::updateStrokeNode(ShapePathData *d, QQuickShapeGenericNode *node)
-{
- if (!node->m_strokeNode)
- return;
- if (!(d->effectiveDirty & (DirtyStrokeGeom | DirtyColor)))
- return;
-
- QQuickShapeGenericStrokeFillNode *n = node->m_strokeNode;
- QSGGeometry *g = n->m_geometry;
- if (d->strokeVertices.isEmpty()) {
- if (g->vertexCount() || g->indexCount()) {
- g->allocate(0, 0);
- n->markDirty(QSGNode::DirtyGeometry);
- }
- return;
- }
-
- n->markDirty(QSGNode::DirtyGeometry);
-
- // Async loading runs update once, bails out above, then updates again once
- // ready. Set the material dirty then. This is in-line with fill where the
- // first activateMaterial() achieves the same.
- if (!g->vertexCount())
- n->markDirty(QSGNode::DirtyMaterial);
-
- if ((d->effectiveDirty & DirtyColor) && !(d->effectiveDirty & DirtyStrokeGeom)) {
- ColoredVertex *vdst = reinterpret_cast<ColoredVertex *>(g->vertexData());
- for (int i = 0; i < g->vertexCount(); ++i)
- vdst[i].set(vdst[i].x, vdst[i].y, d->strokeColor);
- return;
- }
-
- g->allocate(d->strokeVertices.count(), 0);
- g->setDrawingMode(QSGGeometry::DrawTriangleStrip);
- memcpy(g->vertexData(), d->strokeVertices.constData(), g->vertexCount() * g->sizeOfVertex());
-}
-
-QSGMaterial *QQuickShapeGenericMaterialFactory::createVertexColor(QQuickWindow *window)
-{
- QSGRendererInterface::GraphicsApi api = window->rendererInterface()->graphicsApi();
-
-#ifndef QT_NO_OPENGL
- if (api == QSGRendererInterface::OpenGL) // ### so much for "generic"...
- return new QSGVertexColorMaterial;
-#endif
-
- qWarning("Vertex-color material: Unsupported graphics API %d", api);
- return nullptr;
-}
-
-QSGMaterial *QQuickShapeGenericMaterialFactory::createLinearGradient(QQuickWindow *window,
- QQuickShapeGenericStrokeFillNode *node)
-{
- QSGRendererInterface::GraphicsApi api = window->rendererInterface()->graphicsApi();
-
-#ifndef QT_NO_OPENGL
- if (api == QSGRendererInterface::OpenGL) // ### so much for "generic"...
- return new QQuickShapeLinearGradientMaterial(node);
-#endif
-
- qWarning("Linear gradient material: Unsupported graphics API %d", api);
- return nullptr;
-}
-
-#ifndef QT_NO_OPENGL
-
-QSGMaterialType QQuickShapeLinearGradientShader::type;
-
-QQuickShapeLinearGradientShader::QQuickShapeLinearGradientShader()
-{
- setShaderSourceFile(QOpenGLShader::Vertex,
- QStringLiteral(":/qt-project.org/items/shaders/lineargradient.vert"));
- setShaderSourceFile(QOpenGLShader::Fragment,
- QStringLiteral(":/qt-project.org/items/shaders/lineargradient.frag"));
-}
-
-void QQuickShapeLinearGradientShader::initialize()
-{
- m_opacityLoc = program()->uniformLocation("opacity");
- m_matrixLoc = program()->uniformLocation("matrix");
- m_gradStartLoc = program()->uniformLocation("gradStart");
- m_gradEndLoc = program()->uniformLocation("gradEnd");
-}
-
-void QQuickShapeLinearGradientShader::updateState(const RenderState &state, QSGMaterial *mat, QSGMaterial *)
-{
- QQuickShapeLinearGradientMaterial *m = static_cast<QQuickShapeLinearGradientMaterial *>(mat);
-
- if (state.isOpacityDirty())
- program()->setUniformValue(m_opacityLoc, state.opacity());
-
- if (state.isMatrixDirty())
- program()->setUniformValue(m_matrixLoc, state.combinedMatrix());
-
- QQuickShapeGenericStrokeFillNode *node = m->node();
- program()->setUniformValue(m_gradStartLoc, QVector2D(node->m_fillGradient.start));
- program()->setUniformValue(m_gradEndLoc, QVector2D(node->m_fillGradient.end));
-
- QSGTexture *tx = QQuickShapeGradientCache::currentCache()->get(node->m_fillGradient);
- tx->bind();
-}
-
-char const *const *QQuickShapeLinearGradientShader::attributeNames() const
-{
- static const char *const attr[] = { "vertexCoord", "vertexColor", nullptr };
- return attr;
-}
-
-int QQuickShapeLinearGradientMaterial::compare(const QSGMaterial *other) const
-{
- Q_ASSERT(other && type() == other->type());
- const QQuickShapeLinearGradientMaterial *m = static_cast<const QQuickShapeLinearGradientMaterial *>(other);
-
- QQuickShapeGenericStrokeFillNode *a = node();
- QQuickShapeGenericStrokeFillNode *b = m->node();
- Q_ASSERT(a && b);
- if (a == b)
- return 0;
-
- const QQuickShapeGradientCache::GradientDesc *ga = &a->m_fillGradient;
- const QQuickShapeGradientCache::GradientDesc *gb = &b->m_fillGradient;
-
- if (int d = ga->spread - gb->spread)
- return d;
-
- if (int d = ga->start.x() - gb->start.x())
- return d;
- if (int d = ga->start.y() - gb->start.y())
- return d;
- if (int d = ga->end.x() - gb->end.x())
- return d;
- if (int d = ga->end.y() - gb->end.y())
- return d;
-
- if (int d = ga->stops.count() - gb->stops.count())
- return d;
-
- for (int i = 0; i < ga->stops.count(); ++i) {
- if (int d = ga->stops[i].first - gb->stops[i].first)
- return d;
- if (int d = ga->stops[i].second.rgba() - gb->stops[i].second.rgba())
- return d;
- }
-
- return 0;
-}
-
-#endif // QT_NO_OPENGL
-
-QT_END_NAMESPACE
diff --git a/src/imports/shapes/qquickshapegenericrenderer_p.h b/src/imports/shapes/qquickshapegenericrenderer_p.h
deleted file mode 100644
index ba50f50309..0000000000
--- a/src/imports/shapes/qquickshapegenericrenderer_p.h
+++ /dev/null
@@ -1,303 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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 QQUICKSHAPEGENERICRENDERER_P_H
-#define QQUICKSHAPEGENERICRENDERER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of a number of Qt sources files. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qquickshape_p_p.h"
-#include <qsgnode.h>
-#include <qsggeometry.h>
-#include <qsgmaterial.h>
-#include <qsgrendererinterface.h>
-#include <QtCore/qrunnable.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickShapeGenericNode;
-class QQuickShapeGenericStrokeFillNode;
-class QQuickShapeFillRunnable;
-class QQuickShapeStrokeRunnable;
-
-class QQuickShapeGenericRenderer : public QQuickAbstractPathRenderer
-{
-public:
- enum Dirty {
- DirtyFillGeom = 0x01,
- DirtyStrokeGeom = 0x02,
- DirtyColor = 0x04,
- DirtyFillGradient = 0x08,
- DirtyList = 0x10 // only for accDirty
- };
-
- QQuickShapeGenericRenderer(QQuickItem *item)
- : m_item(item),
- m_api(QSGRendererInterface::Unknown),
- m_rootNode(nullptr),
- m_accDirty(0),
- m_asyncCallback(nullptr)
- { }
- ~QQuickShapeGenericRenderer();
-
- void beginSync(int totalCount) override;
- void setPath(int index, const QQuickPath *path) override;
- void setJSPath(int index, const QQuickShapePathCommands &path) override;
- void setStrokeColor(int index, const QColor &color) override;
- void setStrokeWidth(int index, qreal w) override;
- void setFillColor(int index, const QColor &color) override;
- void setFillRule(int index, QQuickShapePath::FillRule fillRule) override;
- void setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit) override;
- void setCapStyle(int index, QQuickShapePath::CapStyle capStyle) override;
- void setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle,
- qreal dashOffset, const QVector<qreal> &dashPattern) override;
- void setFillGradient(int index, QQuickShapeGradient *gradient) override;
- void endSync(bool async) override;
- void setAsyncCallback(void (*)(void *), void *) override;
- Flags flags() const override { return SupportsAsync; }
-
- void updateNode() override;
-
- void setRootNode(QQuickShapeGenericNode *node);
-
- struct Color4ub { unsigned char r, g, b, a; };
- typedef QVector<QSGGeometry::ColoredPoint2D> VertexContainerType;
- typedef QVector<quint32> IndexContainerType;
-
- static void triangulateFill(const QPainterPath &path,
- const Color4ub &fillColor,
- VertexContainerType *fillVertices,
- IndexContainerType *fillIndices,
- QSGGeometry::Type *indexType,
- bool supportsElementIndexUint);
- static void triangulateStroke(const QPainterPath &path,
- const QPen &pen,
- const Color4ub &strokeColor,
- VertexContainerType *strokeVertices,
- const QSize &clipSize);
-
-private:
- void maybeUpdateAsyncItem();
-
- struct ShapePathData {
- float strokeWidth;
- QPen pen;
- Color4ub strokeColor;
- Color4ub fillColor;
- Qt::FillRule fillRule;
- QPainterPath path;
- bool fillGradientActive;
- QQuickShapeGradientCache::GradientDesc fillGradient;
- VertexContainerType fillVertices;
- IndexContainerType fillIndices;
- QSGGeometry::Type indexType;
- VertexContainerType strokeVertices;
- int syncDirty;
- int effectiveDirty = 0;
- QQuickShapeFillRunnable *pendingFill = nullptr;
- QQuickShapeStrokeRunnable *pendingStroke = nullptr;
- };
-
- void updateShadowDataInNode(ShapePathData *d, QQuickShapeGenericStrokeFillNode *n);
- void updateFillNode(ShapePathData *d, QQuickShapeGenericNode *node);
- void updateStrokeNode(ShapePathData *d, QQuickShapeGenericNode *node);
-
- QQuickItem *m_item;
- QSGRendererInterface::GraphicsApi m_api;
- QQuickShapeGenericNode *m_rootNode;
- QVector<ShapePathData> m_sp;
- int m_accDirty;
- void (*m_asyncCallback)(void *);
- void *m_asyncCallbackData;
-};
-
-class QQuickShapeFillRunnable : public QObject, public QRunnable
-{
- Q_OBJECT
-
-public:
- void run() override;
-
- bool orphaned = false;
-
- // input
- QPainterPath path;
- QQuickShapeGenericRenderer::Color4ub fillColor;
- bool supportsElementIndexUint;
-
- // output
- QQuickShapeGenericRenderer::VertexContainerType fillVertices;
- QQuickShapeGenericRenderer::IndexContainerType fillIndices;
- QSGGeometry::Type indexType;
-
-Q_SIGNALS:
- void done(QQuickShapeFillRunnable *self);
-};
-
-class QQuickShapeStrokeRunnable : public QObject, public QRunnable
-{
- Q_OBJECT
-
-public:
- void run() override;
-
- bool orphaned = false;
-
- // input
- QPainterPath path;
- QPen pen;
- QQuickShapeGenericRenderer::Color4ub strokeColor;
- QSize clipSize;
-
- // output
- QQuickShapeGenericRenderer::VertexContainerType strokeVertices;
-
-Q_SIGNALS:
- void done(QQuickShapeStrokeRunnable *self);
-};
-
-class QQuickShapeGenericStrokeFillNode : public QSGGeometryNode
-{
-public:
- QQuickShapeGenericStrokeFillNode(QQuickWindow *window);
- ~QQuickShapeGenericStrokeFillNode();
-
- enum Material {
- MatSolidColor,
- MatLinearGradient
- };
-
- void activateMaterial(Material m);
-
- QQuickWindow *window() const { return m_window; }
-
- // shadow data for custom materials
- QQuickShapeGradientCache::GradientDesc m_fillGradient;
-
-private:
- QSGGeometry *m_geometry;
- QQuickWindow *m_window;
- QSGMaterial *m_material;
- QScopedPointer<QSGMaterial> m_solidColorMaterial;
- QScopedPointer<QSGMaterial> m_linearGradientMaterial;
-
- friend class QQuickShapeGenericRenderer;
-};
-
-class QQuickShapeGenericNode : public QSGNode
-{
-public:
- QQuickShapeGenericStrokeFillNode *m_fillNode = nullptr;
- QQuickShapeGenericStrokeFillNode *m_strokeNode = nullptr;
- QQuickShapeGenericNode *m_next = nullptr;
-};
-
-class QQuickShapeGenericMaterialFactory
-{
-public:
- static QSGMaterial *createVertexColor(QQuickWindow *window);
- static QSGMaterial *createLinearGradient(QQuickWindow *window, QQuickShapeGenericStrokeFillNode *node);
-};
-
-#ifndef QT_NO_OPENGL
-
-class QQuickShapeLinearGradientShader : public QSGMaterialShader
-{
-public:
- QQuickShapeLinearGradientShader();
-
- void initialize() override;
- void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override;
- char const *const *attributeNames() const override;
-
- static QSGMaterialType type;
-
-private:
- int m_opacityLoc;
- int m_matrixLoc;
- int m_gradStartLoc;
- int m_gradEndLoc;
-};
-
-class QQuickShapeLinearGradientMaterial : public QSGMaterial
-{
-public:
- QQuickShapeLinearGradientMaterial(QQuickShapeGenericStrokeFillNode *node)
- : m_node(node)
- {
- // Passing RequiresFullMatrix is essential in order to prevent the
- // batch renderer from baking in simple, translate-only transforms into
- // the vertex data. The shader will rely on the fact that
- // vertexCoord.xy is the Shape-space coordinate and so no modifications
- // are welcome.
- setFlag(Blending | RequiresFullMatrix);
- }
-
- QSGMaterialType *type() const override
- {
- return &QQuickShapeLinearGradientShader::type;
- }
-
- int compare(const QSGMaterial *other) const override;
-
- QSGMaterialShader *createShader() const override
- {
- return new QQuickShapeLinearGradientShader;
- }
-
- QQuickShapeGenericStrokeFillNode *node() const { return m_node; }
-
-private:
- QQuickShapeGenericStrokeFillNode *m_node;
-};
-
-#endif // QT_NO_OPENGL
-
-QT_END_NAMESPACE
-
-#endif // QQUICKSHAPEGENERICRENDERER_P_H
diff --git a/src/imports/shapes/qquickshapenvprrenderer.cpp b/src/imports/shapes/qquickshapenvprrenderer.cpp
deleted file mode 100644
index f3f8d807ec..0000000000
--- a/src/imports/shapes/qquickshapenvprrenderer.cpp
+++ /dev/null
@@ -1,923 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qquickshapenvprrenderer_p.h"
-#include <QOpenGLExtraFunctions>
-#include <QOpenGLFramebufferObject>
-#include <QOpenGLShaderProgram>
-#include <QOpenGLBuffer>
-#include <private/qquickpath_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-void QQuickShapeNvprRenderer::beginSync(int totalCount)
-{
- if (m_sp.count() != totalCount) {
- m_sp.resize(totalCount);
- m_accDirty |= DirtyList;
- }
-}
-
-void QQuickShapeNvprRenderer::setPath(int index, const QQuickPath *path)
-{
- ShapePathGuiData &d(m_sp[index]);
- convertPath(path, &d);
- d.dirty |= DirtyPath;
- m_accDirty |= DirtyPath;
-}
-
-void QQuickShapeNvprRenderer::setJSPath(int index, const QQuickShapePathCommands &path)
-{
- ShapePathGuiData &d(m_sp[index]);
- convertJSPath(path, &d);
- d.dirty |= DirtyPath;
- m_accDirty |= DirtyPath;
-}
-
-void QQuickShapeNvprRenderer::setStrokeColor(int index, const QColor &color)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.strokeColor = color;
- d.dirty |= DirtyStyle;
- m_accDirty |= DirtyStyle;
-}
-
-void QQuickShapeNvprRenderer::setStrokeWidth(int index, qreal w)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.strokeWidth = w;
- d.dirty |= DirtyStyle;
- m_accDirty |= DirtyStyle;
-}
-
-void QQuickShapeNvprRenderer::setFillColor(int index, const QColor &color)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.fillColor = color;
- d.dirty |= DirtyStyle;
- m_accDirty |= DirtyStyle;
-}
-
-void QQuickShapeNvprRenderer::setFillRule(int index, QQuickShapePath::FillRule fillRule)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.fillRule = fillRule;
- d.dirty |= DirtyFillRule;
- m_accDirty |= DirtyFillRule;
-}
-
-void QQuickShapeNvprRenderer::setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.joinStyle = joinStyle;
- d.miterLimit = miterLimit;
- d.dirty |= DirtyStyle;
- m_accDirty |= DirtyStyle;
-}
-
-void QQuickShapeNvprRenderer::setCapStyle(int index, QQuickShapePath::CapStyle capStyle)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.capStyle = capStyle;
- d.dirty |= DirtyStyle;
- m_accDirty |= DirtyStyle;
-}
-
-void QQuickShapeNvprRenderer::setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle,
- qreal dashOffset, const QVector<qreal> &dashPattern)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.dashActive = strokeStyle == QQuickShapePath::DashLine;
- d.dashOffset = dashOffset;
- d.dashPattern = dashPattern;
- d.dirty |= DirtyDash;
- m_accDirty |= DirtyDash;
-}
-
-void QQuickShapeNvprRenderer::setFillGradient(int index, QQuickShapeGradient *gradient)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.fillGradientActive = gradient != nullptr;
- if (gradient) {
- d.fillGradient.stops = gradient->gradientStops(); // sorted
- d.fillGradient.spread = gradient->spread();
- if (QQuickShapeLinearGradient *g = qobject_cast<QQuickShapeLinearGradient *>(gradient)) {
- d.fillGradient.start = QPointF(g->x1(), g->y1());
- d.fillGradient.end = QPointF(g->x2(), g->y2());
- } else {
- Q_UNREACHABLE();
- }
- }
- d.dirty |= DirtyFillGradient;
- m_accDirty |= DirtyFillGradient;
-}
-
-void QQuickShapeNvprRenderer::endSync(bool)
-{
-}
-
-void QQuickShapeNvprRenderer::setNode(QQuickShapeNvprRenderNode *node)
-{
- if (m_node != node) {
- m_node = node;
- m_accDirty |= DirtyList;
- }
-}
-
-QDebug operator<<(QDebug debug, const QQuickShapeNvprRenderer::NvprPath &path)
-{
- QDebugStateSaver saver(debug);
- debug.space().noquote();
- if (!path.str.isEmpty()) {
- debug << "Path with SVG string" << path.str;
- return debug;
- }
- debug << "Path with" << path.cmd.count() << "commands";
- int ci = 0;
- for (GLubyte cmd : path.cmd) {
- static struct { GLubyte cmd; const char *s; int coordCount; } nameTab[] = {
- { GL_MOVE_TO_NV, "moveTo", 2 },
- { GL_LINE_TO_NV, "lineTo", 2 },
- { GL_QUADRATIC_CURVE_TO_NV, "quadTo", 4 },
- { GL_CUBIC_CURVE_TO_NV, "cubicTo", 6 },
- { GL_LARGE_CW_ARC_TO_NV, "arcTo-large-CW", 5 },
- { GL_LARGE_CCW_ARC_TO_NV, "arcTo-large-CCW", 5 },
- { GL_SMALL_CW_ARC_TO_NV, "arcTo-small-CW", 5 },
- { GL_SMALL_CCW_ARC_TO_NV, "arcTo-small-CCW", 5 },
- { GL_CLOSE_PATH_NV, "closePath", 0 } };
- for (size_t i = 0; i < sizeof(nameTab) / sizeof(nameTab[0]); ++i) {
- if (nameTab[i].cmd == cmd) {
- QByteArray cs;
- for (int j = 0; j < nameTab[i].coordCount; ++j) {
- cs.append(QByteArray::number(path.coord[ci++]));
- cs.append(' ');
- }
- debug << "\n " << nameTab[i].s << " " << cs;
- break;
- }
- }
- }
- return debug;
-}
-
-static inline void appendCoords(QVector<GLfloat> *v, QQuickCurve *c, QPointF *pos)
-{
- QPointF p(c->hasRelativeX() ? pos->x() + c->relativeX() : c->x(),
- c->hasRelativeY() ? pos->y() + c->relativeY() : c->y());
- v->append(p.x());
- v->append(p.y());
- *pos = p;
-}
-
-static inline void appendControlCoords(QVector<GLfloat> *v, QQuickPathQuad *c, const QPointF &pos)
-{
- QPointF p(c->hasRelativeControlX() ? pos.x() + c->relativeControlX() : c->controlX(),
- c->hasRelativeControlY() ? pos.y() + c->relativeControlY() : c->controlY());
- v->append(p.x());
- v->append(p.y());
-}
-
-static inline void appendControl1Coords(QVector<GLfloat> *v, QQuickPathCubic *c, const QPointF &pos)
-{
- QPointF p(c->hasRelativeControl1X() ? pos.x() + c->relativeControl1X() : c->control1X(),
- c->hasRelativeControl1Y() ? pos.y() + c->relativeControl1Y() : c->control1Y());
- v->append(p.x());
- v->append(p.y());
-}
-
-static inline void appendControl2Coords(QVector<GLfloat> *v, QQuickPathCubic *c, const QPointF &pos)
-{
- QPointF p(c->hasRelativeControl2X() ? pos.x() + c->relativeControl2X() : c->control2X(),
- c->hasRelativeControl2Y() ? pos.y() + c->relativeControl2Y() : c->control2Y());
- v->append(p.x());
- v->append(p.y());
-}
-
-void QQuickShapeNvprRenderer::convertPath(const QQuickPath *path, ShapePathGuiData *d)
-{
- d->path = NvprPath();
- if (!path)
- return;
-
- const QList<QQuickPathElement *> &pp(QQuickPathPrivate::get(path)->_pathElements);
- if (pp.isEmpty())
- return;
-
- QPointF startPos(path->startX(), path->startY());
- QPointF pos(startPos);
- if (!qFuzzyIsNull(pos.x()) || !qFuzzyIsNull(pos.y())) {
- d->path.cmd.append(GL_MOVE_TO_NV);
- d->path.coord.append(pos.x());
- d->path.coord.append(pos.y());
- }
-
- for (QQuickPathElement *e : pp) {
- if (QQuickPathMove *o = qobject_cast<QQuickPathMove *>(e)) {
- d->path.cmd.append(GL_MOVE_TO_NV);
- appendCoords(&d->path.coord, o, &pos);
- startPos = pos;
- } else if (QQuickPathLine *o = qobject_cast<QQuickPathLine *>(e)) {
- d->path.cmd.append(GL_LINE_TO_NV);
- appendCoords(&d->path.coord, o, &pos);
- } else if (QQuickPathQuad *o = qobject_cast<QQuickPathQuad *>(e)) {
- d->path.cmd.append(GL_QUADRATIC_CURVE_TO_NV);
- appendControlCoords(&d->path.coord, o, pos);
- appendCoords(&d->path.coord, o, &pos);
- } else if (QQuickPathCubic *o = qobject_cast<QQuickPathCubic *>(e)) {
- d->path.cmd.append(GL_CUBIC_CURVE_TO_NV);
- appendControl1Coords(&d->path.coord, o, pos);
- appendControl2Coords(&d->path.coord, o, pos);
- appendCoords(&d->path.coord, o, &pos);
- } else if (QQuickPathArc *o = qobject_cast<QQuickPathArc *>(e)) {
- const bool sweepFlag = o->direction() == QQuickPathArc::Clockwise; // maps to CCW, not a typo
- GLenum cmd;
- if (o->useLargeArc())
- cmd = sweepFlag ? GL_LARGE_CCW_ARC_TO_NV : GL_LARGE_CW_ARC_TO_NV;
- else
- cmd = sweepFlag ? GL_SMALL_CCW_ARC_TO_NV : GL_SMALL_CW_ARC_TO_NV;
- d->path.cmd.append(cmd);
- d->path.coord.append(o->radiusX());
- d->path.coord.append(o->radiusY());
- d->path.coord.append(o->xAxisRotation());
- appendCoords(&d->path.coord, o, &pos);
- } else if (QQuickPathSvg *o = qobject_cast<QQuickPathSvg *>(e)) {
- // PathSvg cannot be combined with other elements. But take at
- // least startX and startY into account.
- if (d->path.str.isEmpty())
- d->path.str = QString(QStringLiteral("M %1 %2 ")).arg(pos.x()).arg(pos.y()).toUtf8();
- d->path.str.append(o->path().toUtf8());
- } else {
- qWarning() << "Shape/NVPR: unsupported Path element" << e;
- }
- }
-
- // For compatibility with QTriangulatingStroker. SVG and others would not
- // implicitly close the path when end_pos == start_pos (start_pos being the
- // last moveTo pos); that would still need an explicit 'z' or similar. We
- // don't have an explicit close command, so just fake a close when the
- // positions match.
- if (pos == startPos)
- d->path.cmd.append(GL_CLOSE_PATH_NV);
-}
-
-void QQuickShapeNvprRenderer::convertJSPath(const QQuickShapePathCommands &path, ShapePathGuiData *d)
-{
- d->path = NvprPath();
- if (path.cmd.isEmpty())
- return;
-
- QPointF startPos(0, 0);
- QPointF pos(startPos);
- int coordIdx = 0;
-
- for (QQuickShapePathCommands::Command cmd : path.cmd) {
- switch (cmd) {
- case QQuickShapePathCommands::MoveTo:
- d->path.cmd.append(GL_MOVE_TO_NV);
- pos = QPointF(path.coords[coordIdx], path.coords[coordIdx + 1]);
- startPos = pos;
- d->path.coord.append(pos.x());
- d->path.coord.append(pos.y());
- coordIdx += 2;
- break;
- case QQuickShapePathCommands::LineTo:
- d->path.cmd.append(GL_LINE_TO_NV);
- pos = QPointF(path.coords[coordIdx], path.coords[coordIdx + 1]);
- d->path.coord.append(pos.x());
- d->path.coord.append(pos.y());
- coordIdx += 2;
- break;
- case QQuickShapePathCommands::QuadTo:
- d->path.cmd.append(GL_QUADRATIC_CURVE_TO_NV);
- d->path.coord.append(path.coords[coordIdx]);
- d->path.coord.append(path.coords[coordIdx + 1]);
- pos = QPointF(path.coords[coordIdx + 2], path.coords[coordIdx + 3]);
- d->path.coord.append(pos.x());
- d->path.coord.append(pos.y());
- coordIdx += 4;
- break;
- case QQuickShapePathCommands::CubicTo:
- d->path.cmd.append(GL_CUBIC_CURVE_TO_NV);
- d->path.coord.append(path.coords[coordIdx]);
- d->path.coord.append(path.coords[coordIdx + 1]);
- d->path.coord.append(path.coords[coordIdx + 2]);
- d->path.coord.append(path.coords[coordIdx + 3]);
- pos = QPointF(path.coords[coordIdx + 4], path.coords[coordIdx + 5]);
- d->path.coord.append(pos.x());
- d->path.coord.append(pos.y());
- coordIdx += 6;
- break;
- case QQuickShapePathCommands::ArcTo:
- {
- const bool sweepFlag = !qFuzzyIsNull(path.coords[coordIdx + 5]);
- const bool useLargeArc = !qFuzzyIsNull(path.coords[coordIdx + 6]);
- GLenum cmd;
- if (useLargeArc)
- cmd = sweepFlag ? GL_LARGE_CCW_ARC_TO_NV : GL_LARGE_CW_ARC_TO_NV;
- else
- cmd = sweepFlag ? GL_SMALL_CCW_ARC_TO_NV : GL_SMALL_CW_ARC_TO_NV;
- d->path.cmd.append(cmd);
- d->path.coord.append(path.coords[coordIdx]); // rx
- d->path.coord.append(path.coords[coordIdx + 1]); // ry
- d->path.coord.append(path.coords[coordIdx + 2]); // xrot
- pos = QPointF(path.coords[coordIdx + 3], path.coords[coordIdx + 4]);
- d->path.coord.append(pos.x());
- d->path.coord.append(pos.y());
- coordIdx += 7;
- }
- break;
- default:
- qWarning("Unknown JS path command: %d", cmd);
- break;
- }
- }
-
- if (pos == startPos)
- d->path.cmd.append(GL_CLOSE_PATH_NV);
-}
-
-static inline QVector4D qsg_premultiply(const QColor &c, float globalOpacity)
-{
- const float o = c.alphaF() * globalOpacity;
- return QVector4D(c.redF() * o, c.greenF() * o, c.blueF() * o, o);
-}
-
-void QQuickShapeNvprRenderer::updateNode()
-{
- // Called on the render thread with gui blocked -> update the node with its
- // own copy of all relevant data.
-
- if (!m_accDirty)
- return;
-
- const int count = m_sp.count();
- const bool listChanged = m_accDirty & DirtyList;
- if (listChanged)
- m_node->m_sp.resize(count);
-
- for (int i = 0; i < count; ++i) {
- ShapePathGuiData &src(m_sp[i]);
- QQuickShapeNvprRenderNode::ShapePathRenderData &dst(m_node->m_sp[i]);
-
- int dirty = src.dirty;
- src.dirty = 0;
- if (listChanged)
- dirty |= DirtyPath | DirtyStyle | DirtyFillRule | DirtyDash | DirtyFillGradient;
-
- // updateNode() can be called several times with different dirty
- // states before render() gets invoked. So accumulate.
- dst.dirty |= dirty;
-
- if (dirty & DirtyPath)
- dst.source = src.path;
-
- if (dirty & DirtyStyle) {
- dst.strokeWidth = src.strokeWidth;
- dst.strokeColor = qsg_premultiply(src.strokeColor, 1.0f);
- dst.fillColor = qsg_premultiply(src.fillColor, 1.0f);
- switch (src.joinStyle) {
- case QQuickShapePath::MiterJoin:
- dst.joinStyle = GL_MITER_TRUNCATE_NV;
- break;
- case QQuickShapePath::BevelJoin:
- dst.joinStyle = GL_BEVEL_NV;
- break;
- case QQuickShapePath::RoundJoin:
- dst.joinStyle = GL_ROUND_NV;
- break;
- default:
- Q_UNREACHABLE();
- }
- dst.miterLimit = src.miterLimit;
- switch (src.capStyle) {
- case QQuickShapePath::FlatCap:
- dst.capStyle = GL_FLAT;
- break;
- case QQuickShapePath::SquareCap:
- dst.capStyle = GL_SQUARE_NV;
- break;
- case QQuickShapePath::RoundCap:
- dst.capStyle = GL_ROUND_NV;
- break;
- default:
- Q_UNREACHABLE();
- }
- }
-
- if (dirty & DirtyFillRule) {
- switch (src.fillRule) {
- case QQuickShapePath::OddEvenFill:
- dst.fillRule = GL_INVERT;
- break;
- case QQuickShapePath::WindingFill:
- dst.fillRule = GL_COUNT_UP_NV;
- break;
- default:
- Q_UNREACHABLE();
- }
- }
-
- if (dirty & DirtyDash) {
- dst.dashOffset = src.dashOffset;
- if (src.dashActive) {
- dst.dashPattern.resize(src.dashPattern.count());
- // Multiply by strokeWidth because the Shape API follows QPen
- // meaning the input dash pattern here is in width units.
- for (int i = 0; i < src.dashPattern.count(); ++i)
- dst.dashPattern[i] = GLfloat(src.dashPattern[i]) * src.strokeWidth;
- } else {
- dst.dashPattern.clear();
- }
- }
-
- if (dirty & DirtyFillGradient) {
- dst.fillGradientActive = src.fillGradientActive;
- if (src.fillGradientActive)
- dst.fillGradient = src.fillGradient;
- }
- }
-
- m_node->markDirty(QSGNode::DirtyMaterial);
- m_accDirty = 0;
-}
-
-bool QQuickShapeNvprRenderNode::nvprInited = false;
-QQuickNvprFunctions QQuickShapeNvprRenderNode::nvpr;
-QQuickNvprMaterialManager QQuickShapeNvprRenderNode::mtlmgr;
-
-QQuickShapeNvprRenderNode::~QQuickShapeNvprRenderNode()
-{
- releaseResources();
-}
-
-void QQuickShapeNvprRenderNode::releaseResources()
-{
- for (ShapePathRenderData &d : m_sp) {
- if (d.path) {
- nvpr.deletePaths(d.path, 1);
- d.path = 0;
- }
- if (d.fallbackFbo) {
- delete d.fallbackFbo;
- d.fallbackFbo = nullptr;
- }
- }
-
- m_fallbackBlitter.destroy();
-}
-
-void QQuickNvprMaterialManager::create(QQuickNvprFunctions *nvpr)
-{
- m_nvpr = nvpr;
-}
-
-void QQuickNvprMaterialManager::releaseResources()
-{
- QOpenGLExtraFunctions *f = QOpenGLContext::currentContext()->extraFunctions();
- for (MaterialDesc &mtl : m_materials) {
- if (mtl.ppl) {
- f->glDeleteProgramPipelines(1, &mtl.ppl);
- mtl = MaterialDesc();
- }
- }
-}
-
-QQuickNvprMaterialManager::MaterialDesc *QQuickNvprMaterialManager::activateMaterial(Material m)
-{
- QOpenGLExtraFunctions *f = QOpenGLContext::currentContext()->extraFunctions();
- MaterialDesc &mtl(m_materials[m]);
-
- if (!mtl.ppl) {
- if (m == MatSolid) {
- static const char *fragSrc =
- "#version 310 es\n"
- "precision highp float;\n"
- "out vec4 fragColor;\n"
- "uniform vec4 color;\n"
- "uniform float opacity;\n"
- "void main() {\n"
- " fragColor = color * opacity;\n"
- "}\n";
- if (!m_nvpr->createFragmentOnlyPipeline(fragSrc, &mtl.ppl, &mtl.prg)) {
- qWarning("NVPR: Failed to create shader pipeline for solid fill");
- return nullptr;
- }
- Q_ASSERT(mtl.ppl && mtl.prg);
- mtl.uniLoc[0] = f->glGetProgramResourceLocation(mtl.prg, GL_UNIFORM, "color");
- Q_ASSERT(mtl.uniLoc[0] >= 0);
- mtl.uniLoc[1] = f->glGetProgramResourceLocation(mtl.prg, GL_UNIFORM, "opacity");
- Q_ASSERT(mtl.uniLoc[1] >= 0);
- } else if (m == MatLinearGradient) {
- static const char *fragSrc =
- "#version 310 es\n"
- "precision highp float;\n"
- "layout(location = 0) in vec2 uv;"
- "uniform float opacity;\n"
- "uniform sampler2D gradTab;\n"
- "uniform vec2 gradStart;\n"
- "uniform vec2 gradEnd;\n"
- "out vec4 fragColor;\n"
- "void main() {\n"
- " vec2 gradVec = gradEnd - gradStart;\n"
- " float gradTabIndex = dot(gradVec, uv - gradStart) / (gradVec.x * gradVec.x + gradVec.y * gradVec.y);\n"
- " fragColor = texture(gradTab, vec2(gradTabIndex, 0.5)) * opacity;\n"
- "}\n";
- if (!m_nvpr->createFragmentOnlyPipeline(fragSrc, &mtl.ppl, &mtl.prg)) {
- qWarning("NVPR: Failed to create shader pipeline for linear gradient");
- return nullptr;
- }
- Q_ASSERT(mtl.ppl && mtl.prg);
- mtl.uniLoc[1] = f->glGetProgramResourceLocation(mtl.prg, GL_UNIFORM, "opacity");
- Q_ASSERT(mtl.uniLoc[1] >= 0);
- mtl.uniLoc[2] = f->glGetProgramResourceLocation(mtl.prg, GL_UNIFORM, "gradStart");
- Q_ASSERT(mtl.uniLoc[2] >= 0);
- mtl.uniLoc[3] = f->glGetProgramResourceLocation(mtl.prg, GL_UNIFORM, "gradEnd");
- Q_ASSERT(mtl.uniLoc[3] >= 0);
- } else {
- Q_UNREACHABLE();
- }
- }
-
- f->glBindProgramPipeline(mtl.ppl);
-
- return &mtl;
-}
-
-void QQuickShapeNvprRenderNode::updatePath(ShapePathRenderData *d)
-{
- if (d->dirty & QQuickShapeNvprRenderer::DirtyPath) {
- if (!d->path) {
- d->path = nvpr.genPaths(1);
- Q_ASSERT(d->path != 0);
- }
- if (d->source.str.isEmpty()) {
- nvpr.pathCommands(d->path, d->source.cmd.count(), d->source.cmd.constData(),
- d->source.coord.count(), GL_FLOAT, d->source.coord.constData());
- } else {
- nvpr.pathString(d->path, GL_PATH_FORMAT_SVG_NV, d->source.str.count(), d->source.str.constData());
- }
- }
-
- if (d->dirty & QQuickShapeNvprRenderer::DirtyStyle) {
- nvpr.pathParameterf(d->path, GL_PATH_STROKE_WIDTH_NV, d->strokeWidth);
- nvpr.pathParameteri(d->path, GL_PATH_JOIN_STYLE_NV, d->joinStyle);
- nvpr.pathParameteri(d->path, GL_PATH_MITER_LIMIT_NV, d->miterLimit);
- nvpr.pathParameteri(d->path, GL_PATH_END_CAPS_NV, d->capStyle);
- nvpr.pathParameteri(d->path, GL_PATH_DASH_CAPS_NV, d->capStyle);
- }
-
- if (d->dirty & QQuickShapeNvprRenderer::DirtyDash) {
- nvpr.pathParameterf(d->path, GL_PATH_DASH_OFFSET_NV, d->dashOffset);
- // count == 0 -> no dash
- nvpr.pathDashArray(d->path, d->dashPattern.count(), d->dashPattern.constData());
- }
-
- if (d->dirty)
- d->fallbackValid = false;
-}
-
-void QQuickShapeNvprRenderNode::renderStroke(ShapePathRenderData *d, int strokeStencilValue, int writeMask)
-{
- QQuickNvprMaterialManager::MaterialDesc *mtl = mtlmgr.activateMaterial(QQuickNvprMaterialManager::MatSolid);
- f->glProgramUniform4f(mtl->prg, mtl->uniLoc[0],
- d->strokeColor.x(), d->strokeColor.y(), d->strokeColor.z(), d->strokeColor.w());
- f->glProgramUniform1f(mtl->prg, mtl->uniLoc[1], inheritedOpacity());
-
- nvpr.stencilThenCoverStrokePath(d->path, strokeStencilValue, writeMask, GL_CONVEX_HULL_NV);
-}
-
-void QQuickShapeNvprRenderNode::renderFill(ShapePathRenderData *d)
-{
- QQuickNvprMaterialManager::MaterialDesc *mtl = nullptr;
- if (d->fillGradientActive) {
- mtl = mtlmgr.activateMaterial(QQuickNvprMaterialManager::MatLinearGradient);
- QSGTexture *tx = QQuickShapeGradientCache::currentCache()->get(d->fillGradient);
- tx->bind();
- // uv = vec2(coeff[0] * x + coeff[1] * y + coeff[2], coeff[3] * x + coeff[4] * y + coeff[5])
- // where x and y are in path coordinate space, which is just what
- // we need since the gradient's start and stop are in that space too.
- GLfloat coeff[6] = { 1, 0, 0,
- 0, 1, 0 };
- nvpr.programPathFragmentInputGen(mtl->prg, 0, GL_OBJECT_LINEAR_NV, 2, coeff);
- f->glProgramUniform2f(mtl->prg, mtl->uniLoc[2], d->fillGradient.start.x(), d->fillGradient.start.y());
- f->glProgramUniform2f(mtl->prg, mtl->uniLoc[3], d->fillGradient.end.x(), d->fillGradient.end.y());
- } else {
- mtl = mtlmgr.activateMaterial(QQuickNvprMaterialManager::MatSolid);
- f->glProgramUniform4f(mtl->prg, mtl->uniLoc[0],
- d->fillColor.x(), d->fillColor.y(), d->fillColor.z(), d->fillColor.w());
- }
- f->glProgramUniform1f(mtl->prg, mtl->uniLoc[1], inheritedOpacity());
-
- const int writeMask = 0xFF;
- nvpr.stencilThenCoverFillPath(d->path, d->fillRule, writeMask, GL_BOUNDING_BOX_NV);
-}
-
-void QQuickShapeNvprRenderNode::renderOffscreenFill(ShapePathRenderData *d)
-{
- if (d->fallbackValid && d->fallbackFbo)
- return;
-
- GLfloat bb[4];
- nvpr.getPathParameterfv(d->path, GL_PATH_STROKE_BOUNDING_BOX_NV, bb);
- QSize sz = QSizeF(bb[2] - bb[0] + 1, bb[3] - bb[1] + 1).toSize();
- d->fallbackSize = QSize(qMax(32, sz.width()), qMax(32, sz.height()));
- d->fallbackTopLeft = QPointF(bb[0], bb[1]);
-
- if (d->fallbackFbo && d->fallbackFbo->size() != d->fallbackSize) {
- delete d->fallbackFbo;
- d->fallbackFbo = nullptr;
- }
- if (!d->fallbackFbo)
- d->fallbackFbo = new QOpenGLFramebufferObject(d->fallbackSize, QOpenGLFramebufferObject::CombinedDepthStencil);
- if (!d->fallbackFbo->bind())
- return;
-
- GLint prevViewport[4];
- f->glGetIntegerv(GL_VIEWPORT, prevViewport);
-
- f->glViewport(0, 0, d->fallbackSize.width(), d->fallbackSize.height());
- f->glDisable(GL_DEPTH_TEST);
- f->glClearColor(0, 0, 0, 0);
- f->glClearStencil(0);
- f->glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
- f->glStencilFunc(GL_NOTEQUAL, 0, 0xFF);
- f->glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
-
- QMatrix4x4 mv;
- mv.translate(-d->fallbackTopLeft.x(), -d->fallbackTopLeft.y());
- nvpr.matrixLoadf(GL_PATH_MODELVIEW_NV, mv.constData());
- QMatrix4x4 proj;
- proj.ortho(0, d->fallbackSize.width(), d->fallbackSize.height(), 0, 1, -1);
- nvpr.matrixLoadf(GL_PATH_PROJECTION_NV, proj.constData());
-
- renderFill(d);
-
- d->fallbackFbo->release();
- f->glEnable(GL_DEPTH_TEST);
- f->glViewport(prevViewport[0], prevViewport[1], prevViewport[2], prevViewport[3]);
-
- d->fallbackValid = true;
-}
-
-void QQuickShapeNvprRenderNode::setupStencilForCover(bool stencilClip, int sv)
-{
- if (!stencilClip) {
- // Assume stencil buffer is cleared to 0 for each frame.
- // Within the frame dppass=GL_ZERO for glStencilOp ensures stencil is reset and so no need to clear.
- f->glStencilFunc(GL_NOTEQUAL, 0, 0xFF);
- f->glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO);
- } else {
- f->glStencilFunc(GL_LESS, sv, 0xFF); // pass if (sv & 0xFF) < (stencil_value & 0xFF)
- f->glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); // dppass: replace with the original value (clip's stencil ref value)
- }
-}
-
-void QQuickShapeNvprRenderNode::render(const RenderState *state)
-{
- f = QOpenGLContext::currentContext()->extraFunctions();
-
- if (!nvprInited) {
- if (!nvpr.create()) {
- qWarning("NVPR init failed");
- return;
- }
- mtlmgr.create(&nvpr);
- nvprInited = true;
- }
-
- f->glUseProgram(0);
- f->glStencilMask(~0);
- f->glEnable(GL_STENCIL_TEST);
-
- const bool stencilClip = state->stencilEnabled();
- // when true, the stencil buffer already has a clip path with a ref value of sv
- const int sv = state->stencilValue();
- const bool hasScissor = state->scissorEnabled();
-
- if (hasScissor) {
- // scissor rect is already set, just enable scissoring
- f->glEnable(GL_SCISSOR_TEST);
- }
-
- // Depth test against the opaque batches rendered before.
- f->glEnable(GL_DEPTH_TEST);
- f->glDepthFunc(GL_LESS);
- nvpr.pathCoverDepthFunc(GL_LESS);
- nvpr.pathStencilDepthOffset(-0.05f, -1);
-
- bool reloadMatrices = true;
-
- for (ShapePathRenderData &d : m_sp) {
- updatePath(&d);
-
- const bool hasFill = d.hasFill();
- const bool hasStroke = d.hasStroke();
-
- if (hasFill && stencilClip) {
- // Fall back to a texture when complex clipping is in use and we have
- // to fill. Reconciling glStencilFillPath's and the scenegraph's clip
- // stencil semantics has not succeeded so far...
- if (hasScissor)
- f->glDisable(GL_SCISSOR_TEST);
- renderOffscreenFill(&d);
- reloadMatrices = true;
- if (hasScissor)
- f->glEnable(GL_SCISSOR_TEST);
- }
-
- if (reloadMatrices) {
- reloadMatrices = false;
- nvpr.matrixLoadf(GL_PATH_MODELVIEW_NV, matrix()->constData());
- nvpr.matrixLoadf(GL_PATH_PROJECTION_NV, state->projectionMatrix()->constData());
- }
-
- // Fill!
- if (hasFill) {
- if (!stencilClip) {
- setupStencilForCover(false, 0);
- renderFill(&d);
- } else {
- if (!m_fallbackBlitter.isCreated())
- m_fallbackBlitter.create();
- f->glStencilFunc(GL_EQUAL, sv, 0xFF);
- f->glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
- QMatrix4x4 mv = *matrix();
- mv.translate(d.fallbackTopLeft.x(), d.fallbackTopLeft.y());
- m_fallbackBlitter.texturedQuad(d.fallbackFbo->texture(), d.fallbackFbo->size(),
- *state->projectionMatrix(), mv,
- inheritedOpacity());
- }
- }
-
- // Stroke!
- if (hasStroke) {
- const int strokeStencilValue = 0x80;
- const int writeMask = 0x80;
-
- setupStencilForCover(stencilClip, sv);
- if (stencilClip) {
- // for the stencil step (eff. read mask == 0xFF & ~writeMask)
- nvpr.pathStencilFunc(GL_EQUAL, sv, 0xFF);
- // With stencilCLip == true the read mask for the stencil test before the stencil step is 0x7F.
- // This assumes the clip stencil value is <= 127.
- if (sv >= strokeStencilValue)
- qWarning("Shape/NVPR: stencil clip ref value %d too large; expect rendering errors", sv);
- }
-
- renderStroke(&d, strokeStencilValue, writeMask);
- }
-
- if (stencilClip)
- nvpr.pathStencilFunc(GL_ALWAYS, 0, ~0);
-
- d.dirty = 0;
- }
-
- f->glBindProgramPipeline(0);
-}
-
-QSGRenderNode::StateFlags QQuickShapeNvprRenderNode::changedStates() const
-{
- return BlendState | StencilState | DepthState | ScissorState;
-}
-
-QSGRenderNode::RenderingFlags QQuickShapeNvprRenderNode::flags() const
-{
- return DepthAwareRendering; // avoid hitting the less optimal no-opaque-batch path in the renderer
-}
-
-bool QQuickShapeNvprRenderNode::isSupported()
-{
- static const bool nvprDisabled = qEnvironmentVariableIntValue("QT_NO_NVPR") != 0;
- return !nvprDisabled && QQuickNvprFunctions::isSupported();
-}
-
-bool QQuickNvprBlitter::create()
-{
- if (isCreated())
- destroy();
-
- m_program = new QOpenGLShaderProgram;
- if (QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile) {
- m_program->addCacheableShaderFromSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/items/shaders/shadereffect_core.vert"));
- m_program->addCacheableShaderFromSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/items/shaders/shadereffect_core.frag"));
- } else {
- m_program->addCacheableShaderFromSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/items/shaders/shadereffect.vert"));
- m_program->addCacheableShaderFromSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/items/shaders/shadereffect.frag"));
- }
- m_program->bindAttributeLocation("qt_Vertex", 0);
- m_program->bindAttributeLocation("qt_MultiTexCoord0", 1);
- if (!m_program->link())
- return false;
-
- m_matrixLoc = m_program->uniformLocation("qt_Matrix");
- m_opacityLoc = m_program->uniformLocation("qt_Opacity");
-
- m_buffer = new QOpenGLBuffer;
- if (!m_buffer->create())
- return false;
- m_buffer->bind();
- m_buffer->allocate(4 * sizeof(GLfloat) * 6);
- m_buffer->release();
-
- return true;
-}
-
-void QQuickNvprBlitter::destroy()
-{
- if (m_program) {
- delete m_program;
- m_program = nullptr;
- }
- if (m_buffer) {
- delete m_buffer;
- m_buffer = nullptr;
- }
-}
-
-void QQuickNvprBlitter::texturedQuad(GLuint textureId, const QSize &size,
- const QMatrix4x4 &proj, const QMatrix4x4 &modelview,
- float opacity)
-{
- QOpenGLExtraFunctions *f = QOpenGLContext::currentContext()->extraFunctions();
-
- m_program->bind();
-
- QMatrix4x4 m = proj * modelview;
- m_program->setUniformValue(m_matrixLoc, m);
- m_program->setUniformValue(m_opacityLoc, opacity);
-
- m_buffer->bind();
-
- if (size != m_prevSize) {
- m_prevSize = size;
-
- QPointF p0(size.width() - 1, size.height() - 1);
- QPointF p1(0, 0);
- QPointF p2(0, size.height() - 1);
- QPointF p3(size.width() - 1, 0);
-
- GLfloat vertices[6 * 4] = {
- GLfloat(p0.x()), GLfloat(p0.y()), 1, 0,
- GLfloat(p1.x()), GLfloat(p1.y()), 0, 1,
- GLfloat(p2.x()), GLfloat(p2.y()), 0, 0,
-
- GLfloat(p0.x()), GLfloat(p0.y()), 1, 0,
- GLfloat(p3.x()), GLfloat(p3.y()), 1, 1,
- GLfloat(p1.x()), GLfloat(p1.y()), 0, 1,
- };
-
- m_buffer->write(0, vertices, sizeof(vertices));
- }
-
- m_program->enableAttributeArray(0);
- m_program->enableAttributeArray(1);
- f->glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), 0);
- f->glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), (const void *) (2 * sizeof(GLfloat)));
-
- f->glBindTexture(GL_TEXTURE_2D, textureId);
-
- f->glDrawArrays(GL_TRIANGLES, 0, 6);
-
- f->glBindTexture(GL_TEXTURE_2D, 0);
- m_buffer->release();
- m_program->release();
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/shapes/qquickshapenvprrenderer_p.h b/src/imports/shapes/qquickshapenvprrenderer_p.h
deleted file mode 100644
index 33007313d4..0000000000
--- a/src/imports/shapes/qquickshapenvprrenderer_p.h
+++ /dev/null
@@ -1,237 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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 QQUICKSHAPENVPRRENDERER_P_H
-#define QQUICKSHAPENVPRRENDERER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of a number of Qt sources files. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qquickshape_p_p.h"
-#include "qquicknvprfunctions_p.h"
-#include <qsgrendernode.h>
-#include <QColor>
-#include <QVector4D>
-#include <QDebug>
-
-#ifndef QT_NO_OPENGL
-
-QT_BEGIN_NAMESPACE
-
-class QQuickShapeNvprRenderNode;
-class QOpenGLFramebufferObject;
-class QOpenGLBuffer;
-class QOpenGLExtraFunctions;
-
-class QQuickShapeNvprRenderer : public QQuickAbstractPathRenderer
-{
-public:
- enum Dirty {
- DirtyPath = 0x01,
- DirtyStyle = 0x02,
- DirtyFillRule = 0x04,
- DirtyDash = 0x08,
- DirtyFillGradient = 0x10,
- DirtyList = 0x20
- };
-
- void beginSync(int totalCount) override;
- void setPath(int index, const QQuickPath *path) override;
- void setJSPath(int index, const QQuickShapePathCommands &path) override;
- void setStrokeColor(int index, const QColor &color) override;
- void setStrokeWidth(int index, qreal w) override;
- void setFillColor(int index, const QColor &color) override;
- void setFillRule(int index, QQuickShapePath::FillRule fillRule) override;
- void setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit) override;
- void setCapStyle(int index, QQuickShapePath::CapStyle capStyle) override;
- void setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle,
- qreal dashOffset, const QVector<qreal> &dashPattern) override;
- void setFillGradient(int index, QQuickShapeGradient *gradient) override;
- void endSync(bool async) override;
-
- void updateNode() override;
-
- void setNode(QQuickShapeNvprRenderNode *node);
-
- struct NvprPath {
- QVector<GLubyte> cmd;
- QVector<GLfloat> coord;
- QByteArray str;
- };
-
-private:
- struct ShapePathGuiData {
- int dirty = 0;
- NvprPath path;
- qreal strokeWidth;
- QColor strokeColor;
- QColor fillColor;
- QQuickShapePath::JoinStyle joinStyle;
- int miterLimit;
- QQuickShapePath::CapStyle capStyle;
- QQuickShapePath::FillRule fillRule;
- bool dashActive;
- qreal dashOffset;
- QVector<qreal> dashPattern;
- bool fillGradientActive;
- QQuickShapeGradientCache::GradientDesc fillGradient;
- };
-
- void convertPath(const QQuickPath *path, ShapePathGuiData *d);
- void convertJSPath(const QQuickShapePathCommands &path, ShapePathGuiData *d);
-
- QQuickShapeNvprRenderNode *m_node = nullptr;
- int m_accDirty = 0;
-
- QVector<ShapePathGuiData> m_sp;
-};
-
-QDebug operator<<(QDebug debug, const QQuickShapeNvprRenderer::NvprPath &path);
-
-class QQuickNvprMaterialManager
-{
-public:
- enum Material {
- MatSolid,
- MatLinearGradient,
-
- NMaterials
- };
-
- struct MaterialDesc {
- GLuint ppl = 0;
- GLuint prg = 0;
- int uniLoc[4];
- };
-
- void create(QQuickNvprFunctions *nvpr);
- MaterialDesc *activateMaterial(Material m);
- void releaseResources();
-
-private:
- QQuickNvprFunctions *m_nvpr;
- MaterialDesc m_materials[NMaterials];
-};
-
-class QQuickNvprBlitter
-{
-public:
- bool create();
- void destroy();
- bool isCreated() const { return m_program != nullptr; }
- void texturedQuad(GLuint textureId, const QSize &size,
- const QMatrix4x4 &proj, const QMatrix4x4 &modelview,
- float opacity);
-
-private:
- QOpenGLShaderProgram *m_program = nullptr;
- QOpenGLBuffer *m_buffer = nullptr;
- int m_matrixLoc;
- int m_opacityLoc;
- QSize m_prevSize;
-};
-
-class QQuickShapeNvprRenderNode : public QSGRenderNode
-{
-public:
- ~QQuickShapeNvprRenderNode();
-
- void render(const RenderState *state) override;
- void releaseResources() override;
- StateFlags changedStates() const override;
- RenderingFlags flags() const override;
-
- static bool isSupported();
-
-private:
- struct ShapePathRenderData {
- GLuint path = 0;
- int dirty = 0;
- QQuickShapeNvprRenderer::NvprPath source;
- GLfloat strokeWidth;
- QVector4D strokeColor;
- QVector4D fillColor;
- GLenum joinStyle;
- GLint miterLimit;
- GLenum capStyle;
- GLenum fillRule;
- GLfloat dashOffset;
- QVector<GLfloat> dashPattern;
- bool fillGradientActive;
- QQuickShapeGradientCache::GradientDesc fillGradient;
- QOpenGLFramebufferObject *fallbackFbo = nullptr;
- bool fallbackValid = false;
- QSize fallbackSize;
- QPointF fallbackTopLeft;
-
- bool hasFill() const { return !qFuzzyIsNull(fillColor.w()) || fillGradientActive; }
- bool hasStroke() const { return strokeWidth >= 0.0f && !qFuzzyIsNull(strokeColor.w()); }
- };
-
- void updatePath(ShapePathRenderData *d);
- void renderStroke(ShapePathRenderData *d, int strokeStencilValue, int writeMask);
- void renderFill(ShapePathRenderData *d);
- void renderOffscreenFill(ShapePathRenderData *d);
- void setupStencilForCover(bool stencilClip, int sv);
-
- static bool nvprInited;
- static QQuickNvprFunctions nvpr;
- static QQuickNvprMaterialManager mtlmgr;
-
- QQuickNvprBlitter m_fallbackBlitter;
- QOpenGLExtraFunctions *f = nullptr;
-
- QVector<ShapePathRenderData> m_sp;
-
- friend class QQuickShapeNvprRenderer;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL
-
-#endif // QQUICKSHAPENVPRRENDERER_P_H
diff --git a/src/imports/shapes/qquickshapesoftwarerenderer.cpp b/src/imports/shapes/qquickshapesoftwarerenderer.cpp
deleted file mode 100644
index b3373106af..0000000000
--- a/src/imports/shapes/qquickshapesoftwarerenderer.cpp
+++ /dev/null
@@ -1,277 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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$
-**
-****************************************************************************/
-
-#include "qquickshapesoftwarerenderer_p.h"
-#include <private/qquickpath_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-void QQuickShapeSoftwareRenderer::beginSync(int totalCount)
-{
- if (m_sp.count() != totalCount) {
- m_sp.resize(totalCount);
- m_accDirty |= DirtyList;
- }
-}
-
-void QQuickShapeSoftwareRenderer::setPath(int index, const QQuickPath *path)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.path = path ? path->path() : QPainterPath();
- d.dirty |= DirtyPath;
- m_accDirty |= DirtyPath;
-}
-
-void QQuickShapeSoftwareRenderer::setJSPath(int index, const QQuickShapePathCommands &path)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.path = path.toPainterPath();
- d.dirty |= DirtyPath;
- m_accDirty |= DirtyPath;
-}
-
-void QQuickShapeSoftwareRenderer::setStrokeColor(int index, const QColor &color)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.pen.setColor(color);
- d.dirty |= DirtyPen;
- m_accDirty |= DirtyPen;
-}
-
-void QQuickShapeSoftwareRenderer::setStrokeWidth(int index, qreal w)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.strokeWidth = w;
- if (w >= 0.0f)
- d.pen.setWidthF(w);
- d.dirty |= DirtyPen;
- m_accDirty |= DirtyPen;
-}
-
-void QQuickShapeSoftwareRenderer::setFillColor(int index, const QColor &color)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.fillColor = color;
- d.brush.setColor(color);
- d.dirty |= DirtyBrush;
- m_accDirty |= DirtyBrush;
-}
-
-void QQuickShapeSoftwareRenderer::setFillRule(int index, QQuickShapePath::FillRule fillRule)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.fillRule = Qt::FillRule(fillRule);
- d.dirty |= DirtyFillRule;
- m_accDirty |= DirtyFillRule;
-}
-
-void QQuickShapeSoftwareRenderer::setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.pen.setJoinStyle(Qt::PenJoinStyle(joinStyle));
- d.pen.setMiterLimit(miterLimit);
- d.dirty |= DirtyPen;
- m_accDirty |= DirtyPen;
-}
-
-void QQuickShapeSoftwareRenderer::setCapStyle(int index, QQuickShapePath::CapStyle capStyle)
-{
- ShapePathGuiData &d(m_sp[index]);
- d.pen.setCapStyle(Qt::PenCapStyle(capStyle));
- d.dirty |= DirtyPen;
- m_accDirty |= DirtyPen;
-}
-
-void QQuickShapeSoftwareRenderer::setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle,
- qreal dashOffset, const QVector<qreal> &dashPattern)
-{
- ShapePathGuiData &d(m_sp[index]);
- switch (strokeStyle) {
- case QQuickShapePath::SolidLine:
- d.pen.setStyle(Qt::SolidLine);
- break;
- case QQuickShapePath::DashLine:
- d.pen.setStyle(Qt::CustomDashLine);
- d.pen.setDashPattern(dashPattern);
- d.pen.setDashOffset(dashOffset);
- break;
- default:
- break;
- }
- d.dirty |= DirtyPen;
- m_accDirty |= DirtyPen;
-}
-
-void QQuickShapeSoftwareRenderer::setFillGradient(int index, QQuickShapeGradient *gradient)
-{
- ShapePathGuiData &d(m_sp[index]);
- if (QQuickShapeLinearGradient *linearGradient = qobject_cast<QQuickShapeLinearGradient *>(gradient)) {
- QLinearGradient painterGradient(linearGradient->x1(), linearGradient->y1(),
- linearGradient->x2(), linearGradient->y2());
- painterGradient.setStops(linearGradient->gradientStops()); // sorted
- switch (gradient->spread()) {
- case QQuickShapeGradient::PadSpread:
- painterGradient.setSpread(QGradient::PadSpread);
- break;
- case QQuickShapeGradient::RepeatSpread:
- painterGradient.setSpread(QGradient::RepeatSpread);
- break;
- case QQuickShapeGradient::ReflectSpread:
- painterGradient.setSpread(QGradient::ReflectSpread);
- break;
- default:
- break;
- }
- d.brush = QBrush(painterGradient);
- } else {
- d.brush = QBrush(d.fillColor);
- }
- d.dirty |= DirtyBrush;
- m_accDirty |= DirtyBrush;
-}
-
-void QQuickShapeSoftwareRenderer::endSync(bool)
-{
-}
-
-void QQuickShapeSoftwareRenderer::setNode(QQuickShapeSoftwareRenderNode *node)
-{
- if (m_node != node) {
- m_node = node;
- m_accDirty |= DirtyList;
- }
-}
-
-void QQuickShapeSoftwareRenderer::updateNode()
-{
- if (!m_accDirty)
- return;
-
- const int count = m_sp.count();
- const bool listChanged = m_accDirty & DirtyList;
- if (listChanged)
- m_node->m_sp.resize(count);
-
- m_node->m_boundingRect = QRectF();
-
- for (int i = 0; i < count; ++i) {
- ShapePathGuiData &src(m_sp[i]);
- QQuickShapeSoftwareRenderNode::ShapePathRenderData &dst(m_node->m_sp[i]);
-
- if (listChanged || (src.dirty & DirtyPath)) {
- dst.path = src.path;
- dst.path.setFillRule(src.fillRule);
- }
-
- if (listChanged || (src.dirty & DirtyFillRule))
- dst.path.setFillRule(src.fillRule);
-
- if (listChanged || (src.dirty & DirtyPen)) {
- dst.pen = src.pen;
- dst.strokeWidth = src.strokeWidth;
- }
-
- if (listChanged || (src.dirty & DirtyBrush))
- dst.brush = src.brush;
-
- src.dirty = 0;
-
- QRectF br = dst.path.boundingRect();
- const float sw = qMax(1.0f, dst.strokeWidth);
- br.adjust(-sw, -sw, sw, sw);
- m_node->m_boundingRect |= br;
- }
-
- m_node->markDirty(QSGNode::DirtyMaterial);
- m_accDirty = 0;
-}
-
-QQuickShapeSoftwareRenderNode::QQuickShapeSoftwareRenderNode(QQuickShape *item)
- : m_item(item)
-{
-}
-
-QQuickShapeSoftwareRenderNode::~QQuickShapeSoftwareRenderNode()
-{
- releaseResources();
-}
-
-void QQuickShapeSoftwareRenderNode::releaseResources()
-{
-}
-
-void QQuickShapeSoftwareRenderNode::render(const RenderState *state)
-{
- if (m_sp.isEmpty())
- return;
-
- QSGRendererInterface *rif = m_item->window()->rendererInterface();
- QPainter *p = static_cast<QPainter *>(rif->getResource(m_item->window(), QSGRendererInterface::PainterResource));
- Q_ASSERT(p);
-
- const QRegion *clipRegion = state->clipRegion();
- if (clipRegion && !clipRegion->isEmpty())
- p->setClipRegion(*clipRegion, Qt::ReplaceClip); // must be done before setTransform
-
- p->setTransform(matrix()->toTransform());
- p->setOpacity(inheritedOpacity());
-
- for (const ShapePathRenderData &d : qAsConst(m_sp)) {
- p->setPen(d.strokeWidth >= 0.0f && d.pen.color() != Qt::transparent ? d.pen : Qt::NoPen);
- p->setBrush(d.brush.color() != Qt::transparent ? d.brush : Qt::NoBrush);
- p->drawPath(d.path);
- }
-}
-
-QSGRenderNode::StateFlags QQuickShapeSoftwareRenderNode::changedStates() const
-{
- return 0;
-}
-
-QSGRenderNode::RenderingFlags QQuickShapeSoftwareRenderNode::flags() const
-{
- return BoundedRectRendering; // avoid fullscreen updates by saying we won't draw outside rect()
-}
-
-QRectF QQuickShapeSoftwareRenderNode::rect() const
-{
- return m_boundingRect;
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/shapes/qquickshapesoftwarerenderer_p.h b/src/imports/shapes/qquickshapesoftwarerenderer_p.h
deleted file mode 100644
index 53982ce347..0000000000
--- a/src/imports/shapes/qquickshapesoftwarerenderer_p.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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 QQUICKSHAPESOFTWARERENDERER_P_H
-#define QQUICKSHAPESOFTWARERENDERER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of a number of Qt sources files. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qquickshape_p_p.h"
-#include <qsgrendernode.h>
-#include <QPen>
-#include <QBrush>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickShapeSoftwareRenderNode;
-
-class QQuickShapeSoftwareRenderer : public QQuickAbstractPathRenderer
-{
-public:
- enum Dirty {
- DirtyPath = 0x01,
- DirtyPen = 0x02,
- DirtyFillRule = 0x04,
- DirtyBrush = 0x08,
- DirtyList = 0x10
- };
-
- void beginSync(int totalCount) override;
- void setPath(int index, const QQuickPath *path) override;
- void setJSPath(int index, const QQuickShapePathCommands &path) override;
- void setStrokeColor(int index, const QColor &color) override;
- void setStrokeWidth(int index, qreal w) override;
- void setFillColor(int index, const QColor &color) override;
- void setFillRule(int index, QQuickShapePath::FillRule fillRule) override;
- void setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit) override;
- void setCapStyle(int index, QQuickShapePath::CapStyle capStyle) override;
- void setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle,
- qreal dashOffset, const QVector<qreal> &dashPattern) override;
- void setFillGradient(int index, QQuickShapeGradient *gradient) override;
- void endSync(bool async) override;
-
- void updateNode() override;
-
- void setNode(QQuickShapeSoftwareRenderNode *node);
-
-private:
- QQuickShapeSoftwareRenderNode *m_node = nullptr;
- int m_accDirty = 0;
- struct ShapePathGuiData {
- int dirty = 0;
- QPainterPath path;
- QPen pen;
- float strokeWidth;
- QColor fillColor;
- QBrush brush;
- Qt::FillRule fillRule;
- };
- QVector<ShapePathGuiData> m_sp;
-};
-
-class QQuickShapeSoftwareRenderNode : public QSGRenderNode
-{
-public:
- QQuickShapeSoftwareRenderNode(QQuickShape *item);
- ~QQuickShapeSoftwareRenderNode();
-
- void render(const RenderState *state) override;
- void releaseResources() override;
- StateFlags changedStates() const override;
- RenderingFlags flags() const override;
- QRectF rect() const override;
-
-private:
- QQuickShape *m_item;
-
- struct ShapePathRenderData {
- QPainterPath path;
- QPen pen;
- float strokeWidth;
- QBrush brush;
- };
- QVector<ShapePathRenderData> m_sp;
- QRectF m_boundingRect;
-
- friend class QQuickShapeSoftwareRenderer;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKSHAPESOFTWARERENDERER_P_H
diff --git a/src/imports/shapes/shapes.pro b/src/imports/shapes/shapes.pro
index 80e6a22142..857fcd7564 100644
--- a/src/imports/shapes/shapes.pro
+++ b/src/imports/shapes/shapes.pro
@@ -1,31 +1,11 @@
CXX_MODULE = qml
TARGET = qmlshapesplugin
TARGETPATH = QtQuick/Shapes
-IMPORT_VERSION = 1.0
+IMPORT_VERSION = 1.$$QT_MINOR_VERSION
-QT = core gui qml quick quick-private
-
-HEADERS += \
- qquickshape_p.h \
- qquickshape_p_p.h \
- qquickshapegenericrenderer_p.h \
- qquickshapesoftwarerenderer_p.h
+QT = core gui-private qml quick-private quickshapes-private
SOURCES += \
plugin.cpp \
- qquickshape.cpp \
- qquickshapegenericrenderer.cpp \
- qquickshapesoftwarerenderer.cpp
-
-qtConfig(opengl) {
- HEADERS += \
- qquicknvprfunctions_p.h \
- qquicknvprfunctions_p_p.h \
- qquickshapenvprrenderer_p.h
-
- SOURCES += \
- qquicknvprfunctions.cpp \
- qquickshapenvprrenderer.cpp
-}
load(qml_plugin)
diff --git a/src/imports/sharedimage/plugin.cpp b/src/imports/sharedimage/plugin.cpp
index 53e95ef21a..b75e38e303 100644
--- a/src/imports/sharedimage/plugin.cpp
+++ b/src/imports/sharedimage/plugin.cpp
@@ -106,7 +106,7 @@ class QtQuickSharedImagePlugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- QtQuickSharedImagePlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) {}
+ QtQuickSharedImagePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) {}
void registerTypes(const char *uri) override
{
diff --git a/src/imports/sharedimage/plugins.qmltypes b/src/imports/sharedimage/plugins.qmltypes
new file mode 100644
index 0000000000..29639e7697
--- /dev/null
+++ b/src/imports/sharedimage/plugins.qmltypes
@@ -0,0 +1,11 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable Qt.labs.sharedimage 1.0'
+
+Module {
+ dependencies: ["QtQuick 2.0"]
+}
diff --git a/src/imports/sharedimage/qsharedimageloader.cpp b/src/imports/sharedimage/qsharedimageloader.cpp
index fb96a79187..c9e3ef3eb3 100644
--- a/src/imports/sharedimage/qsharedimageloader.cpp
+++ b/src/imports/sharedimage/qsharedimageloader.cpp
@@ -88,9 +88,7 @@ class QSharedImageLoaderPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QSharedImageLoader)
public:
- QSharedImageLoaderPrivate()
- : QObjectPrivate()
- {}
+ QSharedImageLoaderPrivate() {}
QImage load(const QString &path, QSharedImageLoader::ImageParameters *params);
@@ -117,7 +115,7 @@ void QSharedImageLoaderPrivate::storeImageToMem(void *data, const QImage &img)
h->format = img.format();
uchar *p = static_cast<uchar *>(data) + sizeof(SharedImageHeader);
- memcpy(p, img.constBits(), img.byteCount());
+ memcpy(p, img.constBits(), img.sizeInBytes());
}
@@ -174,8 +172,11 @@ QImage QSharedImageLoaderPrivate::load(const QString &path, QSharedImageLoader::
QImage img = q->loadFile(path, params);
if (img.isNull())
return nil;
- int size = sizeof(SharedImageHeader) + img.byteCount();
- if (shm->create(size)) {
+ size_t size = sizeof(SharedImageHeader) + img.sizeInBytes();
+ if (size > size_t(std::numeric_limits<int>::max())) {
+ qCDebug(lcSharedImage) << "Image" << path << "to large to load";
+ return nil;
+ } else if (shm->create(int(size))) {
qCDebug(lcSharedImage) << "Created new shm segment of size" << size << "for image" << path;
if (!shm->lock()) {
qCDebug(lcSharedImage) << "Lock1 failed!?" << shm->errorString();
diff --git a/src/imports/sharedimage/qsharedimageloader_p.h b/src/imports/sharedimage/qsharedimageloader_p.h
index 38e2bd4d54..4b0e989c29 100644
--- a/src/imports/sharedimage/qsharedimageloader_p.h
+++ b/src/imports/sharedimage/qsharedimageloader_p.h
@@ -58,10 +58,10 @@ class QSharedImageLoader : public QObject
public:
typedef QVector<QVariant> ImageParameters;
- QSharedImageLoader(QObject *parent = Q_NULLPTR);
+ QSharedImageLoader(QObject *parent = nullptr);
~QSharedImageLoader();
- QImage load(const QString &path, ImageParameters *params = Q_NULLPTR);
+ QImage load(const QString &path, ImageParameters *params = nullptr);
protected:
virtual QImage loadFile(const QString &path, ImageParameters *params);
diff --git a/src/imports/sharedimage/sharedimageprovider.cpp b/src/imports/sharedimage/sharedimageprovider.cpp
index f33057936d..aad6ea3b78 100644
--- a/src/imports/sharedimage/sharedimageprovider.cpp
+++ b/src/imports/sharedimage/sharedimageprovider.cpp
@@ -60,7 +60,7 @@ public:
NumImageParameters
};
- QuickSharedImageLoader(QObject *parent = Q_NULLPTR)
+ QuickSharedImageLoader(QObject *parent = nullptr)
: QSharedImageLoader(parent)
{
}
diff --git a/src/imports/statemachine/dependencies.json b/src/imports/statemachine/dependencies.json
new file mode 100644
index 0000000000..0d4f101c7a
--- /dev/null
+++ b/src/imports/statemachine/dependencies.json
@@ -0,0 +1,2 @@
+[
+]
diff --git a/src/imports/statemachine/plugin.cpp b/src/imports/statemachine/plugin.cpp
index ae32f6446a..bf7499b31a 100644
--- a/src/imports/statemachine/plugin.cpp
+++ b/src/imports/statemachine/plugin.cpp
@@ -47,13 +47,6 @@
#include <QQmlExtensionPlugin>
#include <qqml.h>
-static void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQml_StateMachine);
-#endif
-}
-
QT_BEGIN_NAMESPACE
class QtQmlStateMachinePlugin : public QQmlExtensionPlugin
@@ -62,8 +55,8 @@ class QtQmlStateMachinePlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- QtQmlStateMachinePlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
- void registerTypes(const char *uri) Q_DECL_OVERRIDE
+ QtQmlStateMachinePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
+ void registerTypes(const char *uri) override
{
qmlRegisterType<State>(uri, 1, 0, "State");
qmlRegisterType<StateMachine>(uri, 1, 0, "StateMachine");
@@ -75,6 +68,9 @@ public:
qmlRegisterCustomType<SignalTransition>(uri, 1, 0, "SignalTransition", new SignalTransitionParser);
qmlRegisterType<TimeoutTransition>(uri, 1, 0, "TimeoutTransition");
qmlProtectModule(uri, 1);
+
+ // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward
+ qmlRegisterModule(uri, 1, QT_VERSION_MINOR);
}
};
diff --git a/src/imports/statemachine/plugins.qmltypes b/src/imports/statemachine/plugins.qmltypes
index 0fe9b63e03..f92aeaa080 100644
--- a/src/imports/statemachine/plugins.qmltypes
+++ b/src/imports/statemachine/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -noforceqtquick QtQml.StateMachine 1.0'
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQml.StateMachine 1.13'
Module {
dependencies: []
diff --git a/src/imports/statemachine/signaltransition.cpp b/src/imports/statemachine/signaltransition.cpp
index 0f88ec641b..d4ea25cc4b 100644
--- a/src/imports/statemachine/signaltransition.cpp
+++ b/src/imports/statemachine/signaltransition.cpp
@@ -54,7 +54,7 @@
#include <private/qqmlboundsignal_p.h>
SignalTransition::SignalTransition(QState *parent)
- : QSignalTransition(this, SIGNAL(invokeYourself()), parent), m_complete(false), m_signalExpression(Q_NULLPTR)
+ : QSignalTransition(this, SIGNAL(invokeYourself()), parent), m_complete(false), m_signalExpression(nullptr)
{
connect(this, SIGNAL(signalChanged()), SIGNAL(qmlSignalChanged()));
}
@@ -109,7 +109,7 @@ void SignalTransition::setSignal(const QJSValue &signal)
m_signal = signal;
- QV4::ExecutionEngine *jsEngine = QV8Engine::getV4(QQmlEngine::contextForObject(this)->engine());
+ QV4::ExecutionEngine *jsEngine = QQmlEngine::contextForObject(this)->engine()->handle();
QV4::Scope scope(jsEngine);
QObject *sender;
@@ -163,33 +163,34 @@ void SignalTransition::connectTriggered()
QObject *target = senderObject();
QQmlData *ddata = QQmlData::get(this);
- QQmlContextData *ctxtdata = ddata ? ddata->outerContext : 0;
+ QQmlContextData *ctxtdata = ddata ? ddata->outerContext : nullptr;
Q_ASSERT(m_bindings.count() == 1);
const QV4::CompiledData::Binding *binding = m_bindings.at(0);
Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_Script);
- QV4::ExecutionEngine *jsEngine = QV8Engine::getV4(QQmlEngine::contextForObject(this)->engine());
+ QV4::ExecutionEngine *jsEngine = QQmlEngine::contextForObject(this)->engine()->handle();
QV4::Scope scope(jsEngine);
QV4::Scoped<QV4::QObjectMethod> qobjectSignal(scope, QJSValuePrivate::convertedToValue(jsEngine, m_signal));
Q_ASSERT(qobjectSignal);
QMetaMethod metaMethod = target->metaObject()->method(qobjectSignal->methodIndex());
int signalIndex = QMetaObjectPrivate::signalIndex(metaMethod);
- QQmlBoundSignalExpression *expression = ctxtdata ?
- new QQmlBoundSignalExpression(target, signalIndex,
- ctxtdata, this, m_compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex]) : 0;
+ auto f = m_compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex];
+ QQmlBoundSignalExpression *expression =
+ ctxtdata ? new QQmlBoundSignalExpression(target, signalIndex, ctxtdata, this, f)
+ : nullptr;
if (expression)
expression->setNotifyOnValueChanged(false);
m_signalExpression = expression;
}
-void SignalTransitionParser::verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props)
+void SignalTransitionParser::verifyBindings(const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &props)
{
for (int ii = 0; ii < props.count(); ++ii) {
const QV4::CompiledData::Binding *binding = props.at(ii);
- QString propName = qmlUnit->stringAt(binding->propertyNameIndex);
+ QString propName = compilationUnit->stringAt(binding->propertyNameIndex);
if (propName != QLatin1String("onTriggered")) {
error(props.at(ii), SignalTransition::tr("Cannot assign to non-existent property \"%1\"").arg(propName));
@@ -203,7 +204,7 @@ void SignalTransitionParser::verifyBindings(const QV4::CompiledData::Unit *qmlUn
}
}
-void SignalTransitionParser::applyBindings(QObject *object, QV4::CompiledData::CompilationUnit *compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings)
+void SignalTransitionParser::applyBindings(QObject *object, const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings)
{
SignalTransition *st = qobject_cast<SignalTransition*>(object);
st->m_compilationUnit = compilationUnit;
diff --git a/src/imports/statemachine/signaltransition.h b/src/imports/statemachine/signaltransition.h
index c6512e2b19..90e6f96fbc 100644
--- a/src/imports/statemachine/signaltransition.h
+++ b/src/imports/statemachine/signaltransition.h
@@ -59,13 +59,13 @@ class SignalTransition : public QSignalTransition, public QQmlParserStatus
Q_PROPERTY(QQmlScriptString guard READ guard WRITE setGuard NOTIFY guardChanged)
public:
- explicit SignalTransition(QState *parent = Q_NULLPTR);
+ explicit SignalTransition(QState *parent = nullptr);
QQmlScriptString guard() const;
void setGuard(const QQmlScriptString &guard);
- bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
- void onTransition(QEvent *event) Q_DECL_OVERRIDE;
+ bool eventTest(QEvent *event) override;
+ void onTransition(QEvent *event) override;
const QJSValue &signal();
void setSignal(const QJSValue &signal);
@@ -81,8 +81,8 @@ Q_SIGNALS:
void qmlSignalChanged();
private:
- void classBegin() Q_DECL_OVERRIDE { m_complete = false; }
- void componentComplete() Q_DECL_OVERRIDE { m_complete = true; connectTriggered(); }
+ void classBegin() override { m_complete = false; }
+ void componentComplete() override { m_complete = true; connectTriggered(); }
void connectTriggered();
friend class SignalTransitionParser;
@@ -97,8 +97,8 @@ private:
class SignalTransitionParser : public QQmlCustomParser
{
public:
- void verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props) Q_DECL_OVERRIDE;
- void applyBindings(QObject *object, QV4::CompiledData::CompilationUnit *compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) Q_DECL_OVERRIDE;
+ void verifyBindings(const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &props) override;
+ void applyBindings(QObject *object, const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) override;
};
QT_END_NAMESPACE
diff --git a/src/imports/statemachine/state.cpp b/src/imports/statemachine/state.cpp
index 2467039d01..af76087256 100644
--- a/src/imports/statemachine/state.cpp
+++ b/src/imports/statemachine/state.cpp
@@ -50,7 +50,7 @@ State::State(QState *parent)
void State::componentComplete()
{
- if (this->machine() == NULL) {
+ if (this->machine() == nullptr) {
static bool once = false;
if (!once) {
once = true;
diff --git a/src/imports/statemachine/statemachine.cpp b/src/imports/statemachine/statemachine.cpp
index 7c8dcbc6b6..ca6c59b6ac 100644
--- a/src/imports/statemachine/statemachine.cpp
+++ b/src/imports/statemachine/statemachine.cpp
@@ -68,7 +68,7 @@ void StateMachine::setRunning(bool running)
void StateMachine::componentComplete()
{
- if (QStateMachine::initialState() == NULL && childMode() == QState::ExclusiveStates)
+ if (QStateMachine::initialState() == nullptr && childMode() == QState::ExclusiveStates)
qmlWarning(this) << "No initial state set for StateMachine";
// Everything is proper setup, now start the state-machine if we got
diff --git a/src/imports/statemachine/statemachine.pro b/src/imports/statemachine/statemachine.pro
index 9bb88074e9..926a9d4a5e 100644
--- a/src/imports/statemachine/statemachine.pro
+++ b/src/imports/statemachine/statemachine.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qtqmlstatemachine
TARGETPATH = QtQml/StateMachine
-IMPORT_VERSION = 1.0
+IMPORT_VERSION = 1.$$QT_MINOR_VERSION
QT = core-private qml-private
diff --git a/src/imports/statemachine/timeouttransition.h b/src/imports/statemachine/timeouttransition.h
index 0e5f5377e3..2fc850fc70 100644
--- a/src/imports/statemachine/timeouttransition.h
+++ b/src/imports/statemachine/timeouttransition.h
@@ -53,7 +53,7 @@ class TimeoutTransition : public QSignalTransition, public QQmlParserStatus
Q_INTERFACES(QQmlParserStatus)
public:
- TimeoutTransition(QState *parent = Q_NULLPTR);
+ TimeoutTransition(QState *parent = nullptr);
~TimeoutTransition();
int timeout() const;
diff --git a/src/imports/testlib/SignalSpy.qml b/src/imports/testlib/SignalSpy.qml
index 8a8e844a21..52ed83e261 100644
--- a/src/imports/testlib/SignalSpy.qml
+++ b/src/imports/testlib/SignalSpy.qml
@@ -43,7 +43,7 @@ import QtTest 1.1
/*!
\qmltype SignalSpy
\inqmlmodule QtTest
- \brief Enables introspection of signal emission
+ \brief Enables introspection of signal emission.
\since 4.8
\ingroup qtquicktest
@@ -74,7 +74,7 @@ import QtTest 1.1
synchronously. For asynchronous signals, the wait() method can be
used to block the test until the signal occurs (or a timeout expires).
- \sa {QtTest::TestCase}{TestCase}, {Qt Quick Test Reference Documentation}
+ \sa {QtTest::TestCase}{TestCase}, {Qt Quick Test}
*/
Item {
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index dbed896c59..e7669fd03d 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -39,25 +39,25 @@
import QtQuick 2.0
import QtQuick.Window 2.0 // used for qtest_verifyItem
-import QtTest 1.1
+import QtTest 1.2
import "testlogger.js" as TestLogger
import Qt.test.qtestroot 1.0
/*!
\qmltype TestCase
\inqmlmodule QtTest
- \brief Represents a unit test case
+ \brief Represents a unit test case.
\since 4.8
\ingroup qtquicktest
- \section1 Introduction to QML test cases
+ \section1 Introduction to QML Test Cases
Test cases are written as JavaScript functions within a TestCase
type:
\code
import QtQuick 2.0
- import QtTest 1.0
+ import QtTest 1.2
TestCase {
name: "MathTests"
@@ -99,7 +99,7 @@ import Qt.test.qtestroot 1.0
once they have all completed. If a test case doesn't need to run
(because a precondition has failed), then \l optional can be set to true.
- \section1 Data-driven tests
+ \section1 Data-driven Tests
Table data can be provided to a test using a function name that ends
with "_data". Alternatively, the \c init_data() function can be used
@@ -108,7 +108,7 @@ import Qt.test.qtestroot 1.0
\code
import QtQuick 2.0
- import QtTest 1.1
+ import QtTest 1.2
TestCase {
name: "DataTests"
@@ -173,7 +173,7 @@ import Qt.test.qtestroot 1.0
To get the effect of the \c{QBENCHMARK_ONCE} macro, prefix the test
function name with "benchmark_once_".
- \section1 Simulating keyboard and mouse events
+ \section1 Simulating Keyboard and Mouse Events
The keyPress(), keyRelease(), and keyClick() methods can be used
to simulate keyboard events within unit tests. The events are
@@ -260,7 +260,7 @@ import Qt.test.qtestroot 1.0
For objects that are created via the \l {Component::}{createObject()} function
of \l Component, the \l createTemporaryObject() function can be used.
- \sa {QtTest::SignalSpy}{SignalSpy}, {Qt Quick Test Reference Documentation}
+ \sa {QtTest::SignalSpy}{SignalSpy}, {Qt Quick Test}
*/
@@ -521,6 +521,75 @@ Item {
}
/*!
+ \since 5.13
+ \qmlmethod bool TestCase::isPolishScheduled(object item)
+
+ Returns \c true if \l {QQuickItem::}{updatePolish()} has not been called
+ on \a item since the last call to \l {QQuickItem::}{polish()},
+ otherwise returns \c false.
+
+ When assigning values to properties in QML, any layouting the item
+ must do as a result of the assignment might not take effect immediately,
+ but can instead be postponed until the item is polished. For these cases,
+ you can use this function to ensure that the item has been polished
+ before the execution of the test continues. For example:
+
+ \code
+ verify(isPolishScheduled(item))
+ verify(waitForItemPolished(item))
+ \endcode
+
+ Without the call to \c isPolishScheduled() above, the
+ call to \c waitForItemPolished() might see that no polish
+ was scheduled and therefore pass instantly, assuming that
+ the item had already been polished. This function
+ makes it obvious why an item wasn't polished and allows tests to
+ fail early under such circumstances.
+
+ \sa waitForItemPolished(), QQuickItem::polish(), QQuickItem::updatePolish()
+ */
+ function isPolishScheduled(item) {
+ if (!item || typeof item !== "object") {
+ qtest_results.fail("Argument must be a valid Item; actual type is " + typeof item,
+ util.callerFile(), util.callerLine())
+ throw new Error("QtQuickTest::fail")
+ }
+
+ return qtest_results.isPolishScheduled(item)
+ }
+
+ /*!
+ \since 5.13
+ \qmlmethod bool waitForItemPolished(object item, int timeout = 5000)
+
+ Waits for \a timeout milliseconds or until
+ \l {QQuickItem::}{updatePolish()} has been called on \a item.
+
+ Returns \c true if \c updatePolish() was called on \a item within
+ \a timeout milliseconds, otherwise returns \c false.
+
+ \sa isPolishScheduled(), QQuickItem::polish(), QQuickItem::updatePolish()
+ */
+ function waitForItemPolished(item, timeout) {
+ if (!item || typeof item !== "object") {
+ qtest_results.fail("First argument must be a valid Item; actual type is " + typeof item,
+ util.callerFile(), util.callerLine())
+ throw new Error("QtQuickTest::fail")
+ }
+
+ if (timeout !== undefined && typeof(timeout) != "number") {
+ qtest_results.fail("Second argument must be a number; actual type is " + typeof timeout,
+ util.callerFile(), util.callerLine())
+ throw new Error("QtQuickTest::fail")
+ }
+
+ if (!timeout)
+ timeout = 5000
+
+ return qtest_results.waitForItemPolished(item, timeout)
+ }
+
+ /*!
\since 5.9
\qmlmethod object TestCase::createTemporaryQmlObject(string qml, object parent, string filePath)
@@ -757,6 +826,10 @@ Item {
bProperties.push(i); // collect exp's properties
}
+ if (aProperties.length == 0 && bProperties.length == 0) { // at least a special case for QUrl
+ return eq && (JSON.stringify(act) == JSON.stringify(exp));
+ }
+
// Ensures identical properties name
return eq && qtest_compareInternal(aProperties.sort(), bProperties.sort());
@@ -846,12 +919,12 @@ Item {
Additionally, the returned image object has the following methods:
\list
- \li red(x, y) Returns the red channel value of the pixel at \a x, \a y position
- \li green(x, y) Returns the green channel value of the pixel at \a x, \a y position
- \li blue(x, y) Returns the blue channel value of the pixel at \a x, \a y position
- \li alpha(x, y) Returns the alpha channel value of the pixel at \a x, \a y position
- \li pixel(x, y) Returns the color value of the pixel at \a x, \a y position
- \li equals(image) Returns \c true if this image is identical to \a image -
+ \li \c {red(x, y)} Returns the red channel value of the pixel at \e x, \e y position
+ \li \c {green(x, y)} Returns the green channel value of the pixel at \e x, \e y position
+ \li \c {blue(x, y)} Returns the blue channel value of the pixel at \e x, \e y position
+ \li \c {alpha(x, y)} Returns the alpha channel value of the pixel at \e x, \e y position
+ \li \c {pixel(x, y)} Returns the color value of the pixel at \e x, \e y position
+ \li \c {equals(image)} Returns \c true if this image is identical to \e image -
see \l QImage::operator== (since 5.6)
For example:
@@ -865,7 +938,8 @@ Item {
var newImage = grabImage(rect);
verify(!newImage.equals(image));
\endcode
- \li save(path) Saves the image to the given \a path. If the image cannot
+
+ \li \c {save(path)} Saves the image to the given \e path. If the image cannot
be saved, an exception will be thrown. (since 5.10)
This can be useful to perform postmortem analysis on failing tests, for
@@ -882,8 +956,6 @@ Item {
\endcode
\endlist
-
- \sa
*/
function grabImage(item) {
return qtest_results.grabImage(item);
@@ -1080,6 +1152,24 @@ Item {
does not occur, then the test will fail. Similar to
\c{QTest::ignoreMessage(QtWarningMsg, message)} in C++.
+ Since Qt 5.12, \a message can be either a string, or a regular
+ expression providing a pattern of messages to ignore.
+
+ For example, the following snippet will ignore a string warning message:
+ \qml
+ ignoreWarning("Something sort of bad happened")
+ \endqml
+
+ And the following snippet will ignore a regular expression matching a
+ number of possible warning messages:
+ \qml
+ ignoreWarning(new RegExp("[0-9]+ bad things happened"))
+ \endqml
+
+ \note Despite being a JavaScript RegExp object, it will not be
+ interpreted as such; instead, the pattern will be passed to
+ \l QRegularExpression.
+
\sa warn()
*/
function ignoreWarning(msg) {
@@ -1130,7 +1220,7 @@ Item {
/*!
\qmlmethod TestCase::keyPress(key, modifiers = Qt.NoModifier, delay = -1)
- Simulates pressing a \a key with an optional \a modifier on the currently
+ Simulates pressing a \a key with optional \a modifiers on the currently
focused item. If \a delay is larger than 0, the test will wait for
\a delay milliseconds.
@@ -1158,7 +1248,7 @@ Item {
/*!
\qmlmethod TestCase::keyRelease(key, modifiers = Qt.NoModifier, delay = -1)
- Simulates releasing a \a key with an optional \a modifier on the currently
+ Simulates releasing a \a key with optional \a modifiers on the currently
focused item. If \a delay is larger than 0, the test will wait for
\a delay milliseconds.
@@ -1184,7 +1274,7 @@ Item {
/*!
\qmlmethod TestCase::keyClick(key, modifiers = Qt.NoModifier, delay = -1)
- Simulates clicking of \a key with an optional \a modifier on the currently
+ Simulates clicking of \a key with optional \a modifiers on the currently
focused item. If \a delay is larger than 0, the test will wait for
\a delay milliseconds.
@@ -1208,9 +1298,29 @@ Item {
}
/*!
+ \since 5.10
+ \qmlmethod TestCase::keySequence(keySequence)
+
+ Simulates typing of \a keySequence. The key sequence can be set
+ to one of the \l{QKeySequence::StandardKey}{standard keyboard shortcuts}, or
+ it can be described with a string containing a sequence of up to four key
+ presses.
+
+ Each event shall be sent to the TestCase window or, in case of multiple windows,
+ to the current active window. See \l QGuiApplication::focusWindow() for more details.
+
+ \sa keyPress(), keyRelease(), {GNU Emacs Style Key Sequences},
+ {QtQuick::Shortcut::sequence}{Shortcut.sequence}
+ */
+ function keySequence(keySequence) {
+ if (!qtest_events.keySequence(keySequence))
+ qtest_fail("window not shown", 2)
+ }
+
+ /*!
\qmlmethod TestCase::mousePress(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
- Simulates pressing a mouse \a button with an optional \a modifier
+ Simulates pressing a mouse \a button with optional \a modifiers
on an \a item. The position is defined by \a x and \a y.
If \a x or \a y are not defined the position will be the center of \a item.
If \a delay is specified, the test will wait for the specified amount of
@@ -1244,7 +1354,7 @@ Item {
/*!
\qmlmethod TestCase::mouseRelease(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
- Simulates releasing a mouse \a button with an optional \a modifier
+ Simulates releasing a mouse \a button with optional \a modifiers
on an \a item. The position of the release is defined by \a x and \a y.
If \a x or \a y are not defined the position will be the center of \a item.
If \a delay is specified, the test will wait for the specified amount of
@@ -1278,7 +1388,7 @@ Item {
/*!
\qmlmethod TestCase::mouseDrag(item, x, y, dx, dy, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
- Simulates dragging the mouse on an \a item with \a button pressed and an optional \a modifier.
+ Simulates dragging the mouse on an \a item with \a button pressed and optional \a modifiers
The initial drag position is defined by \a x and \a y,
and drag distance is defined by \a dx and \a dy. If \a delay is specified,
the test will wait for the specified amount of milliseconds before releasing the button.
@@ -1288,9 +1398,6 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- Note: this method does not imply a drop action, to make a drop, an additional
- mouseRelease(item, x + dx, y + dy) is needed.
-
\sa mousePress(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseWheel()
*/
function mouseDrag(item, x, y, dx, dy, button, modifiers, delay) {
@@ -1331,7 +1438,7 @@ Item {
/*!
\qmlmethod TestCase::mouseClick(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
- Simulates clicking a mouse \a button with an optional \a modifier
+ Simulates clicking a mouse \a button with optional \a modifiers
on an \a item. The position of the click is defined by \a x and \a y.
If \a x and \a y are not defined the position will be the center of \a item.
If \a delay is specified, the test will wait for the specified amount of
@@ -1365,7 +1472,7 @@ Item {
/*!
\qmlmethod TestCase::mouseDoubleClick(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
- Simulates double-clicking a mouse \a button with an optional \a modifier
+ Simulates double-clicking a mouse \a button with optional \a modifiers
on an \a item. The position of the click is defined by \a x and \a y.
If \a x and \a y are not defined the position will be the center of \a item.
If \a delay is specified, the test will wait for the specified amount of
@@ -1400,7 +1507,7 @@ Item {
\qmlmethod TestCase::mouseDoubleClickSequence(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
Simulates the full sequence of events generated by double-clicking a mouse
- \a button with an optional \a modifier on an \a item.
+ \a button with optional \a modifiers on an \a item.
This method reproduces the sequence of mouse events generated when a user makes
a double click: Press-Release-Press-DoubleClick-Release.
@@ -1466,7 +1573,7 @@ Item {
/*!
\qmlmethod TestCase::mouseWheel(item, x, y, xDelta, yDelta, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
- Simulates rotating the mouse wheel on an \a item with \a button pressed and an optional \a modifier.
+ Simulates rotating the mouse wheel on an \a item with \a button pressed and optional \a modifiers.
The position of the wheel event is defined by \a x and \a y.
If \a delay is specified, the test will wait for the specified amount of milliseconds before releasing the button.
@@ -1735,11 +1842,6 @@ Item {
/*! \internal */
function qtest_run() {
- if (util.printAvailableFunctions) {
- completed = true
- return
- }
-
if (TestLogger.log_start_test()) {
qtest_results.reset()
qtest_results.testCaseName = name
@@ -1750,17 +1852,28 @@ Item {
running = true
// Check the run list to see if this class is mentioned.
- var functionsToRun = qtest_results.functionsToRun
- if (functionsToRun.length > 0) {
+ let checkNames = false
+ let testsToRun = {} // explicitly provided function names to run and their tags for data-driven tests
+
+ if (qtest_results.functionsToRun.length > 0) {
+ checkNames = true
var found = false
- var list = []
+
if (name.length > 0) {
- var prefix = name + "::"
- for (var index in functionsToRun) {
- if (functionsToRun[index].indexOf(prefix) == 0) {
- list.push(functionsToRun[index])
- found = true
- }
+ for (var index in qtest_results.functionsToRun) {
+ let caseFuncName = qtest_results.functionsToRun[index]
+ if (caseFuncName.indexOf(name + "::") != 0)
+ continue
+
+ found = true
+ let funcName = caseFuncName.substring(name.length + 2)
+
+ if (!(funcName in testsToRun))
+ testsToRun[funcName] = []
+
+ let tagName = qtest_results.tagsToRun[index]
+ if (tagName.length > 0) // empty tags mean run all rows
+ testsToRun[funcName].push(tagName)
}
}
if (!found) {
@@ -1772,7 +1885,6 @@ Item {
qtest_results.testCaseName = ""
return
}
- functionsToRun = list
}
// Run the initTestCase function.
@@ -1797,17 +1909,15 @@ Item {
}
testList.sort()
}
- var checkNames = (functionsToRun.length > 0)
+
for (var index in testList) {
var prop = testList[index]
+
+ if (checkNames && !(prop in testsToRun))
+ continue
+
var datafunc = prop + "_data"
var isBenchmark = (prop.indexOf("benchmark_") == 0)
- if (checkNames) {
- var index = functionsToRun.indexOf(name + "::" + prop)
- if (index < 0)
- continue
- functionsToRun.splice(index, 1)
- }
qtest_results.functionName = prop
if (!(datafunc in testCase))
@@ -1817,18 +1927,29 @@ Item {
if (qtest_runInternal(datafunc)) {
var table = qtest_testCaseResult
var haveData = false
+
+ let checkTags = (checkNames && testsToRun[prop].length > 0)
+
qtest_results.initTestTable()
for (var index in table) {
haveData = true
var row = table[index]
if (!row.tag)
row.tag = "row " + index // Must have something
+ if (checkTags) {
+ let tags = testsToRun[prop]
+ let tagIdx = tags.indexOf(row.tag)
+ if (tagIdx < 0)
+ continue
+ tags.splice(tagIdx, 1)
+ }
qtest_results.dataTag = row.tag
if (isBenchmark)
qtest_runBenchmarkFunction(prop, row)
else
qtest_runFunction(prop, row)
qtest_results.dataTag = ""
+ qtest_results.skipped = false
}
if (!haveData) {
if (datafunc === "init_data")
@@ -1846,6 +1967,9 @@ Item {
}
qtest_results.finishTestFunction()
qtest_results.skipped = false
+
+ if (checkNames && testsToRun[prop].length <= 0)
+ delete testsToRun[prop]
}
// Run the cleanupTestCase function.
@@ -1854,8 +1978,21 @@ Item {
qtest_runInternal("cleanupTestCase")
// Complain about missing functions that we were supposed to run.
- if (functionsToRun.length > 0)
- qtest_results.fail("Could not find functions: " + functionsToRun, "", 0)
+ if (checkNames) {
+ let missingTests = []
+ for (var func in testsToRun) {
+ let caseFuncName = name + '::' + func
+ let tags = testsToRun[func]
+ if (tags.length <= 0)
+ missingTests.push(caseFuncName)
+ else
+ for (var i in tags)
+ missingTests.push(caseFuncName + ':' + tags[i])
+ }
+ missingTests.sort()
+ if (missingTests.length > 0)
+ qtest_results.fail("Could not find test functions: " + missingTests, "", 0)
+ }
// Clean up and exit.
running = false
@@ -1890,29 +2027,9 @@ Item {
}
}
-
Component.onCompleted: {
QTestRootObject.hasTestCase = true;
qtest_componentCompleted = true;
-
- if (util.printAvailableFunctions) {
- var testList = []
- for (var prop in testCase) {
- if (prop.indexOf("test_") != 0 && prop.indexOf("benchmark_") != 0)
- continue
- var tail = prop.lastIndexOf("_data");
- if (tail != -1 && tail == (prop.length - 5))
- continue
- // Note: cannot run functions in TestCase elements
- // that lack a name.
- if (name.length > 0)
- testList.push(name + "::" + prop + "()")
- }
- testList.sort()
- for (var index in testList)
- console.log(testList[index])
- return
- }
qtest_testId = TestLogger.log_register_test(name)
if (optional)
TestLogger.log_optional_test(qtest_testId)
diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp
index 3c28000e35..c625c87db7 100644
--- a/src/imports/testlib/main.cpp
+++ b/src/imports/testlib/main.cpp
@@ -54,13 +54,6 @@ QML_DECLARE_TYPE(QuickTestEvent)
#include <QtDebug>
-static void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtTest);
-#endif
-}
-
QT_BEGIN_NAMESPACE
class QuickTestUtil : public QObject
@@ -69,11 +62,11 @@ class QuickTestUtil : public QObject
Q_PROPERTY(bool printAvailableFunctions READ printAvailableFunctions NOTIFY printAvailableFunctionsChanged)
Q_PROPERTY(int dragThreshold READ dragThreshold NOTIFY dragThresholdChanged)
public:
- QuickTestUtil(QObject *parent = 0)
+ QuickTestUtil(QObject *parent = nullptr)
:QObject(parent)
{}
- ~QuickTestUtil()
+ ~QuickTestUtil() override
{}
bool printAvailableFunctions() const
{
@@ -91,19 +84,19 @@ public Q_SLOTS:
{
QString name(v.typeName());
if (v.canConvert<QObject*>()) {
- QQmlType *type = 0;
+ QQmlType type;
const QMetaObject *mo = v.value<QObject*>()->metaObject();
- while (!type && mo) {
+ while (!type.isValid() && mo) {
type = QQmlMetaType::qmlType(mo);
mo = mo->superClass();
}
- if (type) {
- name = type->qmlTypeName();
+ if (type.isValid()) {
+ name = type.qmlTypeName();
}
}
QQmlEngine *engine = qmlEngine(this);
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine->handle());
+ QV4::ExecutionEngine *v4 = engine->handle();
QV4::Scope scope(v4);
QV4::ScopedValue s(scope, v4->newString(name));
return QQmlV4Handle(s);
@@ -116,7 +109,7 @@ public Q_SLOTS:
QQmlV4Handle callerFile(int frameIndex = 0) const
{
QQmlEngine *engine = qmlEngine(this);
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine->handle());
+ QV4::ExecutionEngine *v4 = engine->handle();
QV4::Scope scope(v4);
QVector<QV4::StackFrame> stack = v4->stackTrace(frameIndex + 2);
@@ -129,7 +122,7 @@ public Q_SLOTS:
int callerLine(int frameIndex = 0) const
{
QQmlEngine *engine = qmlEngine(this);
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine->handle());
+ QV4::ExecutionEngine *v4 = engine->handle();
QVector<QV4::StackFrame> stack = v4->stackTrace(frameIndex + 2);
if (stack.size() > frameIndex + 1)
@@ -150,15 +143,20 @@ class QTestQmlModule : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- QTestQmlModule(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
- void registerTypes(const char *uri) Q_DECL_OVERRIDE
+ QTestQmlModule(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
+ void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtTest"));
qmlRegisterType<QuickTestResult, 0>(uri,1,0,"TestResult");
qmlRegisterType<QuickTestResult, 1>(uri,1,1,"TestResult");
+ qmlRegisterType<QuickTestResult, 13>(uri,1,13,"TestResult");
qmlRegisterType<QuickTestEvent>(uri,1,0,"TestEvent");
+ qmlRegisterType<QuickTestEvent>(uri,1,2,"TestEvent");
qmlRegisterType<QuickTestUtil>(uri,1,0,"TestUtil");
qmlRegisterType<QQuickTouchEventSequence>();
+
+ // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward
+ qmlRegisterModule(uri, 1, QT_VERSION_MINOR);
}
};
diff --git a/src/imports/testlib/plugins.qmltypes b/src/imports/testlib/plugins.qmltypes
index 5d7ca51adc..1e081d82ff 100644
--- a/src/imports/testlib/plugins.qmltypes
+++ b/src/imports/testlib/plugins.qmltypes
@@ -4,10 +4,10 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -noforceqtquick QtTest 1.2'
+// 'qmlplugindump -nonrelocatable QtTest 1.13'
Module {
- dependencies: ["QtQuick 2.0"]
+ dependencies: ["QtQuick 2.0", "QtQuick.Window 2.0"]
Component {
name: "QQuickTouchEventSequence"
prototype: "QObject"
@@ -45,8 +45,8 @@ Module {
Component {
name: "QuickTestEvent"
prototype: "QObject"
- exports: ["QtTest/TestEvent 1.0"]
- exportMetaObjectRevisions: [0]
+ exports: ["QtTest/TestEvent 1.0", "QtTest/TestEvent 1.2"]
+ exportMetaObjectRevisions: [0, 0]
Property { name: "defaultMouseDelay"; type: "int"; isReadonly: true }
Method {
name: "keyPress"
@@ -91,6 +91,12 @@ Module {
Parameter { name: "delay"; type: "int" }
}
Method {
+ name: "keySequence"
+ revision: 2
+ type: "bool"
+ Parameter { name: "keySequence"; type: "QVariant" }
+ }
+ Method {
name: "mousePress"
type: "bool"
Parameter { name: "item"; type: "QObject"; isPointer: true }
@@ -171,8 +177,12 @@ Module {
Component {
name: "QuickTestResult"
prototype: "QObject"
- exports: ["QtTest/TestResult 1.0", "QtTest/TestResult 1.1"]
- exportMetaObjectRevisions: [0, 1]
+ exports: [
+ "QtTest/TestResult 1.0",
+ "QtTest/TestResult 1.1",
+ "QtTest/TestResult 1.13"
+ ]
+ exportMetaObjectRevisions: [0, 1, 13]
Enum {
name: "RunMode"
values: {
@@ -189,6 +199,7 @@ Module {
Property { name: "failCount"; type: "int"; isReadonly: true }
Property { name: "skipCount"; type: "int"; isReadonly: true }
Property { name: "functionsToRun"; type: "QStringList"; isReadonly: true }
+ Property { name: "tagsToRun"; type: "QStringList"; isReadonly: true }
Signal { name: "programNameChanged" }
Method { name: "reset" }
Method { name: "startLogging" }
@@ -263,7 +274,7 @@ Module {
}
Method {
name: "ignoreWarning"
- Parameter { name: "message"; type: "string" }
+ Parameter { name: "message"; type: "QJSValue" }
}
Method {
name: "wait"
@@ -309,6 +320,19 @@ Module {
Parameter { name: "parent"; type: "QObject"; isPointer: true }
Parameter { name: "objectName"; type: "string" }
}
+ Method {
+ name: "isPolishScheduled"
+ revision: 13
+ type: "bool"
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ }
+ Method {
+ name: "waitForItemPolished"
+ revision: 13
+ type: "bool"
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ Parameter { name: "timeout"; type: "int" }
+ }
}
Component {
name: "QuickTestUtil"
diff --git a/src/imports/testlib/qmldir b/src/imports/testlib/qmldir
index e5757f6a88..be9039abbb 100644
--- a/src/imports/testlib/qmldir
+++ b/src/imports/testlib/qmldir
@@ -5,3 +5,4 @@ typeinfo plugins.qmltypes
TestCase 1.0 TestCase.qml
TestCase 1.2 TestCase.qml
SignalSpy 1.0 SignalSpy.qml
+depends QtQuick.Window 2.0
diff --git a/src/imports/testlib/testlib.pro b/src/imports/testlib/testlib.pro
index 6e8a6aee72..acbe82e5e6 100644
--- a/src/imports/testlib/testlib.pro
+++ b/src/imports/testlib/testlib.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qmltestplugin
TARGETPATH = QtTest
-IMPORT_VERSION = 1.0
+IMPORT_VERSION = 1.$$QT_MINOR_VERSION
QT += qml quick qmltest qmltest-private qml-private core-private testlib
diff --git a/src/imports/testlib/toucheventsequence.qdoc b/src/imports/testlib/toucheventsequence.qdoc
index f85a1cd4f9..bd3551a669 100644
--- a/src/imports/testlib/toucheventsequence.qdoc
+++ b/src/imports/testlib/toucheventsequence.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 Jeremy Katz
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** 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.
+** 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
@@ -20,7 +20,7 @@
** 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: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,13 +51,13 @@
Events are delivered to the window which contains the item specified in touchEvent.
- \sa TestCase::touchEvent(), QTest::QTouchEventSequence
+ \sa TestCase::touchEvent()
*/
/*!
\qmlmethod TouchEventSequence TouchEventSequence::press(int touchId, object item, real x = item.width / 2, real y = item.height / 2)
- Creates a new point identified as \a touchId, at the point indicated by \a x and \a y relative to \a item.
+ Creates a new point identified as \a touchId, at the point indicated by \e x and \e y relative to \a item.
Further use of the same touch point should maintain the same touchId.
Item defaults to the value provided via touchEvent().
@@ -67,7 +67,7 @@
/*!
\qmlmethod TouchEventSequence TouchEventSequence::move(int touchId, object item, real x = item.width / 2, real y = item.height / 2)
- Moves \a touchId to the point indicated by \a x and \a y relative to \a item.
+ Moves \a touchId to the point indicated by \e x and \e y relative to \a item.
Item defaults to the value provided via touchEvent().
X and y default to the midpoint of the item.
@@ -76,7 +76,7 @@
/*!
\qmlmethod TouchEventSequence TouchEventSequence::release(int touchId, object item, real x = item.width / 2, real y = item.height / 2)
- Removes \a touchId at the point indicated by \a x and \a y relative to \a item.
+ Removes \a touchId at the point indicated by \e x and \e y relative to \a item.
Item defaults to the value provided via touchEvent().
X and y default to the midpoint of the item.
diff --git a/src/imports/xmllistmodel/plugin.cpp b/src/imports/wavefrontmesh/plugin.cpp
index af7625c96a..1a266b7e36 100644
--- a/src/imports/xmllistmodel/plugin.cpp
+++ b/src/imports/wavefrontmesh/plugin.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the QtQml module of the Qt Toolkit.
+** This file is part of the QtQuick module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -40,29 +40,27 @@
#include <QtQml/qqmlextensionplugin.h>
#include <QtQml/qqml.h>
-#include "qqmlxmllistmodel_p.h"
-
-static void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQuick_XmlListModel);
-#endif
-}
+#include "qwavefrontmesh.h"
QT_BEGIN_NAMESPACE
-class QmlXmlListModelPlugin : public QQmlExtensionPlugin
+class QmlWavefrontMeshPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
-
public:
- QmlXmlListModelPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
- void registerTypes(const char *uri) Q_DECL_OVERRIDE
+ QmlWavefrontMeshPlugin(QObject *parent = nullptr)
+ : QQmlExtensionPlugin(parent)
{
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.XmlListModel"));
- qmlRegisterType<QQuickXmlListModel>(uri,2,0,"XmlListModel");
- qmlRegisterType<QQuickXmlListModelRole>(uri,2,0,"XmlRole");
+ }
+
+ void registerTypes(const char *uri) override
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.wavefrontmesh"));
+ qmlRegisterType<QWavefrontMesh>(uri, 1, 0, "WavefrontMesh");
+
+ // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.12 onward
+ qmlRegisterModule(uri, 1, QT_VERSION_MINOR);
}
};
diff --git a/src/imports/wavefrontmesh/plugins.qmltypes b/src/imports/wavefrontmesh/plugins.qmltypes
new file mode 100644
index 0000000000..b9dd9e4c46
--- /dev/null
+++ b/src/imports/wavefrontmesh/plugins.qmltypes
@@ -0,0 +1,37 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable Qt.labs.wavefrontmesh 1.13'
+
+Module {
+ dependencies: ["QtQuick 2.0"]
+ Component {
+ name: "QWavefrontMesh"
+ prototype: "QQuickShaderEffectMesh"
+ exports: ["Qt.labs.wavefrontmesh/WavefrontMesh 1.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Error"
+ values: {
+ "NoError": 0,
+ "InvalidSourceError": 1,
+ "UnsupportedFaceShapeError": 2,
+ "UnsupportedIndexSizeError": 3,
+ "FileNotFoundError": 4,
+ "NoAttributesError": 5,
+ "MissingPositionAttributeError": 6,
+ "MissingTextureCoordinateAttributeError": 7,
+ "MissingPositionAndTextureCoordinateAttributesError": 8,
+ "TooManyAttributesError": 9,
+ "InvalidPlaneDefinitionError": 10
+ }
+ }
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "lastError"; type: "Error"; isReadonly: true }
+ Property { name: "projectionPlaneV"; type: "QVector3D" }
+ Property { name: "projectionPlaneW"; type: "QVector3D" }
+ }
+}
diff --git a/src/imports/wavefrontmesh/qmldir b/src/imports/wavefrontmesh/qmldir
new file mode 100644
index 0000000000..fed15dd06f
--- /dev/null
+++ b/src/imports/wavefrontmesh/qmldir
@@ -0,0 +1,4 @@
+module Qt.labs.wavefrontmesh
+plugin qmlwavefrontmeshplugin
+classname QmlWavefrontMeshPlugin
+typeinfo plugins.qmltypes
diff --git a/src/imports/wavefrontmesh/qwavefrontmesh.cpp b/src/imports/wavefrontmesh/qwavefrontmesh.cpp
new file mode 100644
index 0000000000..101e6ab4b0
--- /dev/null
+++ b/src/imports/wavefrontmesh/qwavefrontmesh.cpp
@@ -0,0 +1,694 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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$
+**
+****************************************************************************/
+
+#include "qwavefrontmesh.h"
+
+#include <QtCore/qfile.h>
+#include <QtCore/qtextstream.h>
+#include <QtCore/private/qobject_p.h>
+
+#include <QtGui/qvector2d.h>
+#include <QtGui/qvector3d.h>
+
+#include <QtQml/qqmlfile.h>
+#include <QtQml/qqmlcontext.h>
+
+#include <QtQuick/qsggeometry.h>
+
+QT_BEGIN_NAMESPACE
+
+static const char qt_position_attribute_name[] = "qt_Vertex";
+static const char qt_texcoord_attribute_name[] = "qt_MultiTexCoord0";
+
+const char *qtPositionAttributeName()
+{
+ return qt_position_attribute_name;
+}
+
+const char *qtTexCoordAttributeName()
+{
+ return qt_texcoord_attribute_name;
+}
+
+class QWavefrontMeshPrivate : public QObjectPrivate
+{
+public:
+ QWavefrontMeshPrivate()
+ : lastError(QWavefrontMesh::NoError)
+ {}
+
+ Q_DECLARE_PUBLIC(QWavefrontMesh)
+
+ static QWavefrontMeshPrivate *get(QWavefrontMesh *mesh)
+ {
+ return mesh->d_func();
+ }
+
+ static const QWavefrontMeshPrivate *get(const QWavefrontMesh *mesh)
+ {
+ return mesh->d_func();
+ }
+
+ QVector<QPair<ushort, ushort> > indexes;
+ QVector<QVector3D> vertexes;
+ QVector<QVector2D> textureCoordinates;
+
+ QUrl source;
+ QWavefrontMesh::Error lastError;
+
+ QVector3D planeV;
+ QVector3D planeW;
+};
+
+/*!
+ \qmlmodule Qt.labs.wavefrontmesh 1.\QtMinorVersion
+ \title Qt Labs WavefrontMesh QML Types
+ \ingroup qmlmodules
+ \brief The WavefrontMesh provides a mesh based on a Wavefront .obj file.
+
+ To use this module, import the module with the following line:
+
+ \qml \QtMinorVersion
+ import Qt.labs.wavefrontmesh 1.\1
+ \endqml
+*/
+
+/*!
+ \qmltype WavefrontMesh
+ \inqmlmodule Qt.labs.wavefrontmesh
+ \instantiates QWavefrontMesh
+ \ingroup qtquick-effects
+ \brief The WavefrontMesh provides a mesh based on a Wavefront .obj file.
+ \since 5.12
+
+ WavefrontMesh reads the geometry from a Wavefront .obj file and generates
+ a two-dimensional \l{QSGGeometry}{geometry} from this. If the .obj file
+ contains a three-dimensional shape, it will be orthographically projected,
+ onto a plane. If defined, this is given by \l projectionPlaneV
+ and \l projectionPlaneW. Otherwise, the first face encountered in the data
+ will be used to determine the projection plane.
+
+ If the file contains texture coordinates, these will also be used. Otherwise,
+ the vertexes of the object will be normalized and used.
+
+ The mesh can be used in a ShaderEffect to define the shaded geometry. The
+ geometry will be normalized before use, so the position and scale of the
+ input objects have no impact on the result.
+
+ \note Some Wavefront exporters will change the source scene's coordinate system
+ before exporting it. This can cause unexpected results when Qt applies the
+ projection. If the visual results are not as you expect, try checking the export
+ parameters and the documentation of the editor tool to see if this is the case.
+
+ For instance, the following example takes an .obj file containing a standard torus
+ and visualizes the automatically generated texture coordinates.
+
+ \table
+ \row
+ \li \image qtlabs-wavefrontmesh.png
+ \li \qml
+ import QtQuick 2.\1
+ import Qt.labs.wavefrontmesh 1.\1
+
+ ShaderEffect {
+ width: 200
+ height: 200
+ mesh: WavefrontMesh {
+ source: "torus.obj"
+ projectionPlaneV: Qt.vector3d(0, 1, 0)
+ projectionPlaneW: Qt.vector3d(1, 0, 0)
+ }
+ vertexShader: "
+ uniform highp mat4 qt_Matrix;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 coord;
+ void main() {
+ coord = qt_MultiTexCoord0;
+ gl_Position = qt_Matrix * qt_Vertex;
+ }"
+ fragmentShader: "
+ varying highp vec2 coord;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = vec4(coord.x, coord.y, 0.0, 1.0);
+ }"
+
+ }
+ \endqml
+ \endtable
+
+ \note Since the input is a 3D torus, we need to define the projection plane. This would not be necessary when
+ using a 2D shape as input. We use the XY plane in this case, because of the orientation of the input.
+*/
+
+QWavefrontMesh::QWavefrontMesh(QObject *parent)
+ : QQuickShaderEffectMesh(*(new QWavefrontMeshPrivate), parent)
+{
+ connect(this, &QWavefrontMesh::sourceChanged, this, &QWavefrontMesh::readData);
+ connect(this, &QWavefrontMesh::projectionPlaneVChanged, this, &QQuickShaderEffectMesh::geometryChanged);
+ connect(this, &QWavefrontMesh::projectionPlaneWChanged, this, &QQuickShaderEffectMesh::geometryChanged);
+}
+
+QWavefrontMesh::~QWavefrontMesh()
+{
+}
+
+/*!
+ \qmlproperty enumeration WavefrontMesh::lastError
+
+ This property holds the last error, if any, that occurred when parsing the
+ source or building the mesh.
+
+ \list
+ \li WavefrontMesh.NoError No error has occurred.
+ \li WavefrontMesh.InvalidSourceError The source was not recognized as a valid .obj file.
+ \li WavefrontMesh.UnsupportedFaceShapeError The faces in the source is of an unsupported type.
+ WavefrontMesh only supports triangles and convex quads.
+ \li WavefrontMesh.UnsupportedIndexSizeError The source shape is too large. Only 16 bit indexes are supported.
+ \li WavefrontMesh.FileNotFoundError The source file was not found.
+ \li WavefrontMesh.MissingPositionAttributeError The 'qt_Vertex' attribute is missing from the shaders.
+ \li WavefrontMesh.MissingTextureCoordinateAttributeError The texture coordinate attribute in the shaders is wrongly named. Use 'qt_MultiTexCoord0'.
+ \li WavefrontMesh.MissingPositionAndTextureCoordinateAttributesError Both the 'qt_Vertex' and 'qt_MultiTexCoord0' attributes are missing from the shaders.
+ \li WavefrontMesh.TooManyAttributesError The shaders expect too many attributes (maximum is two: Position, 'qt_Vertex', and texture coordinate, 'qt_MultiTexCoord0').
+ \li WavefrontMesh.InvalidPlaneDefinitionError The V and W vectors in the plane cannot be null, nor parallel to each other.
+ \endlist
+*/
+
+QWavefrontMesh::Error QWavefrontMesh::lastError() const
+{
+ Q_D(const QWavefrontMesh);
+ return d->lastError;
+}
+
+void QWavefrontMesh::setLastError(Error lastError)
+{
+ Q_D(QWavefrontMesh);
+ if (d->lastError == lastError)
+ return;
+
+ d->lastError = lastError;
+ emit lastErrorChanged();
+}
+
+/*!
+ \qmlproperty url WavefrontMesh::source
+
+ This property holds the URL of the source. This must be either a local file or in qrc. The source will
+ be read as a Wavefront .obj file and the geometry will be updated.
+*/
+QUrl QWavefrontMesh::source() const
+{
+ Q_D(const QWavefrontMesh);
+ return d->source;
+}
+
+void QWavefrontMesh::setSource(const QUrl &source)
+{
+ Q_D(QWavefrontMesh);
+ if (d->source == source)
+ return;
+
+ d->source = source;
+ emit sourceChanged();
+}
+
+void QWavefrontMesh::readData()
+{
+ Q_D(QWavefrontMesh);
+ d->vertexes.clear();
+ d->textureCoordinates.clear();
+ d->indexes.clear();
+
+ QString localFile = QQmlFile::urlToLocalFileOrQrc(d->source);
+ if (!localFile.isEmpty()) {
+ QFile file(localFile);
+ if (file.open(QIODevice::ReadOnly)) {
+ QTextStream stream(&file);
+
+ QString buffer;
+ buffer.reserve(256);
+
+ static QChar space(QLatin1Char(' '));
+ static QChar slash(QLatin1Char('/'));
+
+ while (!stream.atEnd()) {
+ stream.readLineInto(&buffer);
+ QVector<QStringRef> tokens = buffer.splitRef(space, QString::SkipEmptyParts);
+ if (tokens.size() < 2)
+ continue;
+
+ QByteArray command = tokens.at(0).toLatin1();
+
+ if (command == "vt") {
+ bool ok;
+ float u = tokens.at(1).toFloat(&ok);
+ if (!ok) {
+ setLastError(InvalidSourceError);
+ return;
+ }
+
+ float v = tokens.size() > 2 ? tokens.at(2).toFloat(&ok) : 0.0;
+ if (!ok) {
+ setLastError(InvalidSourceError);
+ return;
+ }
+
+ d->textureCoordinates.append(QVector2D(u, v));
+ } else if (command == "v") {
+ // Format: v <x> <y> <z> [w]
+ if (tokens.length() < 4 || tokens.length() > 5) {
+ setLastError(InvalidSourceError);
+ return;
+ }
+
+ bool ok;
+
+ float x = tokens.at(1).toFloat(&ok);
+ if (!ok) {
+ setLastError(InvalidSourceError);
+ return;
+ }
+
+ float y = tokens.at(2).toFloat(&ok);
+ if (!ok) {
+ setLastError(InvalidSourceError);
+ return;
+ }
+
+ float z = tokens.at(3).toFloat(&ok);
+ if (!ok) {
+ setLastError(InvalidSourceError);
+ return;
+ }
+
+ d->vertexes.append(QVector3D(x, y, z));
+ } else if (command == "f") {
+ // The scenegraph only supports triangles, so we
+ // support triangles and quads (which we split up)
+ int p1, p2, p3;
+ int t1 = 0;
+ int t2 = 0;
+ int t3 = 0;
+ if (tokens.size() >= 4 && tokens.size() <= 5) {
+ {
+ bool ok;
+ QVector<QStringRef> faceTokens = tokens.at(1).split(slash, QString::SkipEmptyParts);
+ Q_ASSERT(!faceTokens.isEmpty());
+
+ p1 = faceTokens.at(0).toInt(&ok) - 1;
+ if (!ok) {
+ setLastError(InvalidSourceError);
+ return;
+ }
+
+ if (faceTokens.size() > 1) {
+ t1 = faceTokens.at(1).toInt(&ok) - 1;
+ if (!ok) {
+ setLastError(InvalidSourceError);
+ return;
+ }
+ }
+ }
+
+ {
+ bool ok;
+ QVector<QStringRef> faceTokens = tokens.at(2).split(slash, QString::SkipEmptyParts);
+ Q_ASSERT(!faceTokens.isEmpty());
+
+ p2 = faceTokens.at(0).toInt(&ok) - 1;
+ if (!ok) {
+ setLastError(InvalidSourceError);
+ return;
+ }
+
+ if (faceTokens.size() > 1) {
+ t2 = faceTokens.at(1).toInt(&ok) - 1;
+ if (!ok) {
+ setLastError(InvalidSourceError);
+ return;
+ }
+ }
+ }
+
+ {
+ bool ok;
+ QVector<QStringRef> faceTokens = tokens.at(3).split(slash, QString::SkipEmptyParts);
+ Q_ASSERT(!faceTokens.isEmpty());
+
+ p3 = faceTokens.at(0).toInt(&ok) - 1;
+ if (!ok) {
+ setLastError(InvalidSourceError);
+ return;
+ }
+
+ if (faceTokens.size() > 1) {
+ t3 = faceTokens.at(1).toInt(&ok) - 1;
+ if (!ok) {
+ setLastError(InvalidSourceError);
+ return;
+ }
+ }
+ }
+
+ if (Q_UNLIKELY(p1 < 0 || p1 > UINT16_MAX
+ || p2 < 0 || p2 > UINT16_MAX
+ || p3 < 0 || p3 > UINT16_MAX
+ || t1 < 0 || t1 > UINT16_MAX
+ || t2 < 0 || t2 > UINT16_MAX
+ || t3 < 0 || t3 > UINT16_MAX)) {
+ setLastError(UnsupportedIndexSizeError);
+ return;
+ }
+
+ d->indexes.append(qMakePair(ushort(p1), ushort(t1)));
+ d->indexes.append(qMakePair(ushort(p2), ushort(t2)));
+ d->indexes.append(qMakePair(ushort(p3), ushort(t3)));
+ } else {
+ setLastError(UnsupportedFaceShapeError);
+ return;
+ }
+
+ if (tokens.size() == 5) {
+ bool ok;
+ QVector<QStringRef> faceTokens = tokens.at(4).split(slash, QString::SkipEmptyParts);
+ Q_ASSERT(!faceTokens.isEmpty());
+
+ int p4 = faceTokens.at(0).toInt(&ok) - 1;
+ if (!ok) {
+ setLastError(InvalidSourceError);
+ return;
+ }
+
+ int t4 = 0;
+ if (faceTokens.size() > 1) {
+ t4 = faceTokens.at(1).toInt(&ok) - 1;
+ if (!ok) {
+ setLastError(InvalidSourceError);
+ return;
+ }
+ }
+
+ if (Q_UNLIKELY(p4 < 0 || p4 > UINT16_MAX || t4 < 0 || t4 > UINT16_MAX)) {
+ setLastError(UnsupportedIndexSizeError);
+ return;
+ }
+
+ // ### Assumes convex quad, correct algorithm is to find the concave corner,
+ // and if there is one, do the split on the line between this and the corner it is
+ // not connected to. Also assumes order of vertices is counter clockwise.
+ d->indexes.append(qMakePair(ushort(p3), ushort(t3)));
+ d->indexes.append(qMakePair(ushort(p4), ushort(t4)));
+ d->indexes.append(qMakePair(ushort(p1), ushort(t1)));
+ }
+ }
+ }
+ } else {
+ setLastError(FileNotFoundError);
+ }
+ } else {
+ setLastError(InvalidSourceError);
+ }
+
+ emit geometryChanged();
+}
+
+QString QWavefrontMesh::log() const
+{
+ Q_D(const QWavefrontMesh);
+ switch (d->lastError) {
+ case NoError: return QStringLiteral("No error");
+ case InvalidSourceError: return QStringLiteral("Error: Invalid source");
+ case UnsupportedFaceShapeError: return QStringLiteral("Error: Unsupported face shape in source");
+ case UnsupportedIndexSizeError: return QStringLiteral("Error: Unsupported index size in source");
+ case FileNotFoundError: return QStringLiteral("Error: File not found");
+ case MissingPositionAttributeError: return QStringLiteral("Error: Missing '%1' attribute").arg(qtPositionAttributeName());
+ case MissingTextureCoordinateAttributeError: return QStringLiteral("Error: Missing '%1' attribute").arg(qtTexCoordAttributeName());
+ case MissingPositionAndTextureCoordinateAttributesError: return QStringLiteral("Error: Missing '%1' and '%2' attributes").arg(qtPositionAttributeName()).arg(qtTexCoordAttributeName());
+ case TooManyAttributesError: return QStringLiteral("Error: Too many attributes");
+ case InvalidPlaneDefinitionError: return QStringLiteral("Error: Invalid plane. V and W must be non-null and cannot be parallel");
+ default: return QStringLiteral("Unknown error");
+ };
+}
+
+bool QWavefrontMesh::validateAttributes(const QVector<QByteArray> &attributes, int *posIndex)
+{
+ Q_D(QWavefrontMesh);
+ const int attrCount = attributes.count();
+ int positionIndex = attributes.indexOf(qtPositionAttributeName());
+ int texCoordIndex = attributes.indexOf(qtTexCoordAttributeName());
+
+ switch (attrCount) {
+ case 0:
+ d->lastError = NoAttributesError;
+ return false;
+ case 1:
+ if (positionIndex < 0) {
+ d->lastError = MissingPositionAttributeError;
+ return false;
+ }
+ break;
+ case 2:
+ if (positionIndex < 0 || texCoordIndex < 0) {
+ if (positionIndex < 0 && texCoordIndex < 0)
+ d->lastError = MissingPositionAndTextureCoordinateAttributesError;
+ else if (positionIndex < 0)
+ d->lastError = MissingPositionAttributeError;
+ else if (texCoordIndex < 0)
+ d->lastError = MissingTextureCoordinateAttributeError;
+ return false;
+ }
+ break;
+ default:
+ d->lastError = TooManyAttributesError;
+ return false;
+ }
+
+ if (posIndex)
+ *posIndex = positionIndex;
+
+ return true;
+
+}
+
+QSGGeometry *QWavefrontMesh::updateGeometry(QSGGeometry *geometry, int attributeCount, int positionIndex,
+ const QRectF &sourceRect, const QRectF &destinationRect)
+{
+ Q_D(QWavefrontMesh);
+
+ if (geometry == nullptr) {
+ Q_ASSERT(attributeCount == 1 || attributeCount == 2);
+ geometry = new QSGGeometry(attributeCount == 1
+ ? QSGGeometry::defaultAttributes_Point2D()
+ : QSGGeometry::defaultAttributes_TexturedPoint2D(),
+ d->indexes.size(),
+ d->indexes.size(),
+ QSGGeometry::UnsignedShortType);
+ geometry->setDrawingMode(QSGGeometry::DrawTriangles);
+
+ } else {
+ geometry->allocate(d->indexes.size(), d->indexes.size());
+ }
+
+ // If there is not at least a full triangle in the data set, skip out
+ if (d->indexes.size() < 3) {
+ geometry->allocate(0, 0);
+ return geometry;
+ }
+
+ QVector3D planeV = d->planeV;
+ QVector3D planeW = d->planeW;
+
+ // Automatically detect plane based on first face if none is set
+ if (planeV.isNull() || planeW.isNull()) {
+ QVector3D p = d->vertexes.at(d->indexes.at(0).first);
+ planeV = (d->vertexes.at(d->indexes.at(1).first) - p);
+ planeW = (p - d->vertexes.at(d->indexes.at(2).first)).normalized();
+ }
+
+ planeV.normalize();
+ planeW.normalize();
+
+ QVector3D planeNormal = QVector3D::crossProduct(planeV, planeW).normalized();
+ if (planeNormal.isNull()) { // V and W are either parallel or null
+ setLastError(InvalidPlaneDefinitionError);
+ geometry->allocate(0, 0);
+ return geometry;
+ }
+
+ QVector3D planeAxes1 = planeV;
+ QVector3D planeAxes2 = QVector3D::crossProduct(planeAxes1, planeNormal).normalized();
+
+ ushort *indexData = static_cast<ushort *>(geometry->indexData());
+ QSGGeometry::Point2D *vertexData = static_cast<QSGGeometry::Point2D *>(geometry->vertexData());
+
+ float minX = 0.0f;
+ float maxX = 0.0f;
+ float minY = 0.0f;
+ float maxY = 0.0f;
+ for (ushort i = 0; i < ushort(d->indexes.size()); ++i) {
+ *(indexData + i) = i;
+
+ QVector3D v = d->vertexes.at(d->indexes.at(i).first);
+
+ // Project onto plane
+ QVector2D w;
+ v -= QVector3D::dotProduct(planeNormal, v) * planeNormal;
+ w.setX(QVector3D::dotProduct(v, planeAxes1));
+ w.setY(QVector3D::dotProduct(v, planeAxes2));
+
+ QSGGeometry::Point2D *positionData = vertexData + (i * attributeCount + positionIndex);
+ positionData->x = w.x();
+ positionData->y = w.y();
+
+ if (i == 0 || minX > w.x())
+ minX = w.x();
+ if (i == 0 || maxX < w.x())
+ maxX = w.x();
+ if (i == 0 || minY > w.y())
+ minY = w.y();
+ if (i == 0 || maxY < w.y())
+ maxY = w.y();
+
+ if (attributeCount > 1 && !d->textureCoordinates.isEmpty()) {
+ Q_ASSERT(positionIndex == 0 || positionIndex == 1);
+
+ QVector2D uv = d->textureCoordinates.at(d->indexes.at(i).second);
+ QSGGeometry::Point2D *textureCoordinateData = vertexData + (i * attributeCount + (1 - positionIndex));
+ textureCoordinateData->x = uv.x();
+ textureCoordinateData->y = uv.y();
+ }
+ }
+
+ float width = maxX - minX;
+ float height = maxY - minY;
+
+ QVector2D center(minX + width / 2.0f, minY + height / 2.0f);
+ QVector2D scale(1.0f / width, 1.0f / height);
+
+ for (int i = 0; i < geometry->vertexCount(); ++i) {
+ float x = ((vertexData + positionIndex)->x - center.x()) * scale.x();
+ float y = ((vertexData + positionIndex)->y - center.y()) * scale.y();
+
+ for (int attributeIndex = 0; attributeIndex < attributeCount; ++attributeIndex) {
+ if (attributeIndex == positionIndex) {
+ vertexData->x = float(destinationRect.left()) + x * float(destinationRect.width()) + float(destinationRect.width()) / 2.0f;
+ vertexData->y = float(destinationRect.top()) + y * float(destinationRect.height()) + float(destinationRect.height()) / 2.0f;
+ } else {
+ // If there are no texture coordinates, use the normalized vertex
+ float tx = d->textureCoordinates.isEmpty() ? x : vertexData->x;
+ float ty = d->textureCoordinates.isEmpty() ? y : vertexData->y;
+
+ vertexData->x = float(sourceRect.left()) + tx * float(sourceRect.width());
+ vertexData->y = float(sourceRect.top()) + ty * float(sourceRect.height());
+ }
+
+ ++vertexData;
+ }
+ }
+
+ return geometry;
+}
+
+/*!
+ \qmlproperty vector3d WavefrontMesh::projectionPlaneV
+
+ Since the Wavefront .obj format describes an object in 3D space, the coordinates
+ have to be projected into 2D before they can be displayed in Qt Quick.
+
+ This will be done in WavefrontMesh by an orthographic projection onto an
+ appropriate plane.
+
+ The projectionPlaneV is one of two vectors in the plane in 3D space. If
+ either this, or \l projectionPlaneW is set to (0, 0, 0) (the default),
+ then the plane will be detected based on the first encountered face in the
+ data set.
+
+ \note projectionPlaneV and \l projectionPlaneW cannot be parallel vectors.
+*/
+void QWavefrontMesh::setProjectionPlaneV(const QVector3D &v)
+{
+ Q_D(QWavefrontMesh);
+ if (d->planeV == v)
+ return;
+
+ d->planeV = v;
+ emit projectionPlaneVChanged();
+}
+
+QVector3D QWavefrontMesh::projectionPlaneV() const
+{
+ Q_D(const QWavefrontMesh);
+ return d->planeV;
+}
+
+/*!
+ \qmlproperty vector3d WavefrontMesh::projectionPlaneW
+
+ Since the Wavefront .obj format describes an object in 3D space, the coordinates
+ have to be projected into 2D before they can be displayed in Qt Quick.
+
+ This will be done in WavefrontMesh by an orthographic projection onto an
+ appropriate plane.
+
+ The projectionPlaneW is one of two vectors in the plane in 3D space. If
+ either this, or \l projectionPlaneV is set to (0, 0, 0) (the default),
+ then the plane will be detected based on the first encountered face in the
+ data set.
+
+ \note \l projectionPlaneV and projectionPlaneW cannot be parallel vectors.
+*/
+void QWavefrontMesh::setProjectionPlaneW(const QVector3D &w)
+{
+ Q_D(QWavefrontMesh);
+ if (d->planeW == w)
+ return;
+
+ d->planeW = w;
+ emit projectionPlaneWChanged();
+}
+
+QVector3D QWavefrontMesh::projectionPlaneW() const
+{
+ Q_D(const QWavefrontMesh);
+ return d->planeW;
+}
+
+
+QT_END_NAMESPACE
diff --git a/src/imports/wavefrontmesh/qwavefrontmesh.h b/src/imports/wavefrontmesh/qwavefrontmesh.h
new file mode 100644
index 0000000000..e3ded8078e
--- /dev/null
+++ b/src/imports/wavefrontmesh/qwavefrontmesh.h
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 QWAVEFRONTMESH_H
+#define QWAVEFRONTMESH_H
+
+#include <QtQuick/private/qquickshadereffectmesh_p.h>
+
+#include <QtCore/qurl.h>
+#include <QtGui/qvector3d.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWavefrontMeshPrivate;
+class QWavefrontMesh : public QQuickShaderEffectMesh
+{
+ Q_OBJECT
+ Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
+ Q_PROPERTY(Error lastError READ lastError NOTIFY lastErrorChanged)
+ Q_PROPERTY(QVector3D projectionPlaneV READ projectionPlaneV WRITE setProjectionPlaneV NOTIFY projectionPlaneVChanged)
+ Q_PROPERTY(QVector3D projectionPlaneW READ projectionPlaneW WRITE setProjectionPlaneW NOTIFY projectionPlaneWChanged)
+public:
+ enum Error {
+ NoError,
+ InvalidSourceError,
+ UnsupportedFaceShapeError,
+ UnsupportedIndexSizeError,
+ FileNotFoundError,
+ NoAttributesError,
+ MissingPositionAttributeError,
+ MissingTextureCoordinateAttributeError,
+ MissingPositionAndTextureCoordinateAttributesError,
+ TooManyAttributesError,
+ InvalidPlaneDefinitionError
+ };
+ Q_ENUMS(Error)
+
+ QWavefrontMesh(QObject *parent = nullptr);
+ ~QWavefrontMesh() override;
+
+ QUrl source() const;
+ void setSource(const QUrl &url);
+
+ Error lastError() const;
+ void setLastError(Error lastError);
+
+ bool validateAttributes(const QVector<QByteArray> &attributes, int *posIndex) override;
+ QSGGeometry *updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex,
+ const QRectF &srcRect, const QRectF &rect) override;
+ QString log() const override;
+
+ QVector3D projectionPlaneV() const;
+ void setProjectionPlaneV(const QVector3D &projectionPlaneV);
+
+ QVector3D projectionPlaneW() const;
+ void setProjectionPlaneW(const QVector3D &projectionPlaneW);
+
+Q_SIGNALS:
+ void sourceChanged();
+ void lastErrorChanged();
+ void projectionPlaneVChanged();
+ void projectionPlaneWChanged();
+
+protected Q_SLOTS:
+ void readData();
+
+private:
+ Q_DISABLE_COPY(QWavefrontMesh)
+ Q_DECLARE_PRIVATE(QWavefrontMesh)
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAVEFRONTGEOMETRYMODEL_H
diff --git a/src/imports/wavefrontmesh/wavefrontmesh.pro b/src/imports/wavefrontmesh/wavefrontmesh.pro
new file mode 100644
index 0000000000..85bd500089
--- /dev/null
+++ b/src/imports/wavefrontmesh/wavefrontmesh.pro
@@ -0,0 +1,15 @@
+CXX_MODULE = qml
+TARGET = qmlwavefrontmeshplugin
+TARGETPATH = Qt/labs/wavefrontmesh
+IMPORT_VERSION = 1.$$QT_MINOR_VERSION
+
+QT = core-private qml-private quick-private
+
+SOURCES += \
+ plugin.cpp \
+ qwavefrontmesh.cpp
+
+HEADERS += \
+ qwavefrontmesh.h
+
+load(qml_plugin)
diff --git a/src/imports/window/plugin.cpp b/src/imports/window/plugin.cpp
index 200f6f7b08..dfe1dcf62e 100644
--- a/src/imports/window/plugin.cpp
+++ b/src/imports/window/plugin.cpp
@@ -41,17 +41,10 @@
#include <private/qquickwindowmodule_p.h>
-static void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQuick_Window_2);
-#endif
-}
-
QT_BEGIN_NAMESPACE
/*!
- \qmlmodule QtQuick.Window 2.2
+ \qmlmodule QtQuick.Window 2.\QtMinorVersion
\title Qt Quick Window QML Types
\ingroup qmlmodules
\brief Provides QML types for window management
@@ -60,9 +53,9 @@ QT_BEGIN_NAMESPACE
To use the types in this module, import the module with the following line:
- \code
- import QtQuick.Window 2.2
- \endcode
+ \qml \QtMinorVersion
+ import QtQuick.Window 2.\1
+ \endqml
*/
@@ -72,12 +65,14 @@ class QtQuick2WindowPlugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- QtQuick2WindowPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
- void registerTypes(const char *uri) Q_DECL_OVERRIDE
+ QtQuick2WindowPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
+ void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Window"));
- Q_UNUSED(uri);
QQuickWindowModule::defineModule();
+
+ // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward
+ qmlRegisterModule(uri, 2, QT_VERSION_MINOR);
}
};
//![class decl]
diff --git a/src/imports/window/plugins.qmltypes b/src/imports/window/plugins.qmltypes
index cea2a910a7..b5786ed5a6 100644
--- a/src/imports/window/plugins.qmltypes
+++ b/src/imports/window/plugins.qmltypes
@@ -4,10 +4,10 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtQuick.Window 2.3'
+// 'qmlplugindump -nonrelocatable QtQuick.Window 2.13'
Module {
- dependencies: ["QtQuick 2.8"]
+ dependencies: ["QtQuick 2.0"]
Component {
name: "QQuickRootItem"
defaultProperty: "data"
@@ -43,10 +43,16 @@ Module {
Component {
name: "QQuickScreenInfo"
prototype: "QObject"
- exports: ["QtQuick.Window/ScreenInfo 2.3"]
+ exports: [
+ "QtQuick.Window/ScreenInfo 2.10",
+ "QtQuick.Window/ScreenInfo 2.3"
+ ]
isCreatable: false
- exportMetaObjectRevisions: [2]
+ exportMetaObjectRevisions: [10, 2]
Property { name: "name"; type: "string"; isReadonly: true }
+ Property { name: "manufacturer"; revision: 10; type: "string"; isReadonly: true }
+ Property { name: "model"; revision: 10; type: "string"; isReadonly: true }
+ Property { name: "serialNumber"; revision: 10; type: "string"; isReadonly: true }
Property { name: "width"; type: "int"; isReadonly: true }
Property { name: "height"; type: "int"; isReadonly: true }
Property { name: "desktopAvailableWidth"; type: "int"; isReadonly: true }
@@ -58,6 +64,9 @@ Module {
Property { name: "orientation"; type: "Qt::ScreenOrientation"; isReadonly: true }
Property { name: "virtualX"; revision: 1; type: "int"; isReadonly: true }
Property { name: "virtualY"; revision: 1; type: "int"; isReadonly: true }
+ Signal { name: "manufacturerChanged"; revision: 10 }
+ Signal { name: "modelChanged"; revision: 10 }
+ Signal { name: "serialNumberChanged"; revision: 10 }
Signal { name: "desktopGeometryChanged" }
Signal { name: "virtualXChanged"; revision: 1 }
Signal { name: "virtualYChanged"; revision: 1 }
@@ -69,11 +78,28 @@ Module {
exports: ["QtQuick.Window/Window 2.0"]
exportMetaObjectRevisions: [0]
Enum {
+ name: "CreateTextureOptions"
+ values: {
+ "TextureHasAlphaChannel": 1,
+ "TextureHasMipmaps": 2,
+ "TextureOwnsGLTexture": 4,
+ "TextureCanUseAtlas": 8,
+ "TextureIsOpaque": 16
+ }
+ }
+ Enum {
name: "SceneGraphError"
values: {
"ContextNotAvailable": 1
}
}
+ Enum {
+ name: "TextRenderType"
+ values: {
+ "QtTextRendering": 0,
+ "NativeTextRendering": 1
+ }
+ }
Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
Property { name: "color"; type: "QColor" }
Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
@@ -134,10 +160,11 @@ Module {
prototype: "QQuickWindow"
exports: [
"QtQuick.Window/Window 2.1",
+ "QtQuick.Window/Window 2.13",
"QtQuick.Window/Window 2.2",
"QtQuick.Window/Window 2.3"
]
- exportMetaObjectRevisions: [0, 1, 2]
+ exportMetaObjectRevisions: [0, 13, 1, 2]
attachedType: "QQuickWindowAttached"
Property { name: "visible"; type: "bool" }
Property { name: "visibility"; type: "Visibility" }
@@ -189,6 +216,7 @@ Module {
Property { name: "visibility"; revision: 1; type: "Visibility" }
Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" }
Property { name: "opacity"; revision: 1; type: "double" }
+ Property { name: "transientParent"; revision: 13; type: "QWindow"; isPointer: true }
Signal {
name: "screenChanged"
Parameter { name: "screen"; type: "QScreen"; isPointer: true }
@@ -261,6 +289,11 @@ Module {
revision: 1
Parameter { name: "opacity"; type: "double" }
}
+ Signal {
+ name: "transientParentChanged"
+ revision: 13
+ Parameter { name: "transientParent"; type: "QWindow"; isPointer: true }
+ }
Method { name: "requestActivate"; revision: 1 }
Method {
name: "setVisible"
@@ -296,6 +329,17 @@ Module {
Parameter { name: "arg"; type: "int" }
}
Method {
+ name: "setGeometry"
+ Parameter { name: "posx"; type: "int" }
+ Parameter { name: "posy"; type: "int" }
+ Parameter { name: "w"; type: "int" }
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "setGeometry"
+ Parameter { name: "rect"; type: "QRect" }
+ }
+ Method {
name: "setMinimumWidth"
Parameter { name: "w"; type: "int" }
}
diff --git a/src/imports/window/window.pro b/src/imports/window/window.pro
index a938e0eeef..77bd9518e9 100644
--- a/src/imports/window/window.pro
+++ b/src/imports/window/window.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = windowplugin
TARGETPATH = QtQuick/Window.2
-IMPORT_VERSION = 2.2
+IMPORT_VERSION = 2.$$QT_MINOR_VERSION
SOURCES += \
plugin.cpp
diff --git a/src/imports/xmllistmodel/plugins.qmltypes b/src/imports/xmllistmodel/plugins.qmltypes
deleted file mode 100644
index cc675d5f83..0000000000
--- a/src/imports/xmllistmodel/plugins.qmltypes
+++ /dev/null
@@ -1,59 +0,0 @@
-import QtQuick.tooling 1.2
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtQuick.XmlListModel 2.0'
-
-Module {
- dependencies: ["QtQuick 2.8"]
- Component {
- name: "QQuickXmlListModel"
- defaultProperty: "roles"
- prototype: "QAbstractListModel"
- exports: ["QtQuick.XmlListModel/XmlListModel 2.0"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "Status"
- values: {
- "Null": 0,
- "Ready": 1,
- "Loading": 2,
- "Error": 3
- }
- }
- Property { name: "status"; type: "Status"; isReadonly: true }
- Property { name: "progress"; type: "double"; isReadonly: true }
- Property { name: "source"; type: "QUrl" }
- Property { name: "xml"; type: "string" }
- Property { name: "query"; type: "string" }
- Property { name: "namespaceDeclarations"; type: "string" }
- Property { name: "roles"; type: "QQuickXmlListModelRole"; isList: true; isReadonly: true }
- Property { name: "count"; type: "int"; isReadonly: true }
- Signal {
- name: "statusChanged"
- Parameter { type: "QQuickXmlListModel::Status" }
- }
- Signal {
- name: "progressChanged"
- Parameter { name: "progress"; type: "double" }
- }
- Method { name: "reload" }
- Method {
- name: "get"
- type: "QQmlV4Handle"
- Parameter { name: "index"; type: "int" }
- }
- Method { name: "errorString"; type: "string" }
- }
- Component {
- name: "QQuickXmlListModelRole"
- prototype: "QObject"
- exports: ["QtQuick.XmlListModel/XmlRole 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "name"; type: "string" }
- Property { name: "query"; type: "string" }
- Property { name: "isKey"; type: "bool" }
- }
-}
diff --git a/src/imports/xmllistmodel/qmldir b/src/imports/xmllistmodel/qmldir
deleted file mode 100644
index 1f17dbb112..0000000000
--- a/src/imports/xmllistmodel/qmldir
+++ /dev/null
@@ -1,5 +0,0 @@
-module QtQuick.XmlListModel
-plugin qmlxmllistmodelplugin
-classname QmlXmlListModelPlugin
-typeinfo plugins.qmltypes
-designersupported
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
deleted file mode 100644
index 61c8665a14..0000000000
--- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+++ /dev/null
@@ -1,1207 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml 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 "qqmlxmllistmodel_p.h"
-
-#include <qqmlcontext.h>
-#include <private/qqmlengine_p.h>
-#include <private/qv8engine_p.h>
-#include <private/qv4value_p.h>
-#include <private/qv4engine_p.h>
-#include <private/qv4object_p.h>
-
-#include <QDebug>
-#include <QStringList>
-#include <QMap>
-#include <QThread>
-#include <QXmlQuery>
-#include <QXmlResultItems>
-#include <QXmlNodeModelIndex>
-#include <QBuffer>
-#include <QNetworkRequest>
-#include <QNetworkReply>
-#include <QTimer>
-#include <QMutex>
-
-#include <private/qabstractitemmodel_p.h>
-
-Q_DECLARE_METATYPE(QQuickXmlQueryResult)
-
-QT_BEGIN_NAMESPACE
-
-using namespace QV4;
-
-typedef QPair<int, int> QQuickXmlListRange;
-
-#define XMLLISTMODEL_CLEAR_ID 0
-
-/*!
- \qmlmodule QtQuick.XmlListModel 2
- \title Qt Quick XmlListModel QML Types
- \ingroup qmlmodules
- \brief Provides QML types for creating models from XML data
-
- This QML module contains types for creating models from XML data.
-
- To use the types in this module, import the module with the following line:
-
- \code
- import QtQuick.XmlListModel 2.0
- \endcode
-*/
-
-/*!
- \qmltype XmlRole
- \instantiates QQuickXmlListModelRole
- \inqmlmodule QtQuick.XmlListModel
- \brief For specifying a role to an XmlListModel
- \ingroup qtquick-models
-
- \sa {Qt QML}
-*/
-
-/*!
- \qmlproperty string QtQuick.XmlListModel::XmlRole::name
-
- The name for the role. This name is used to access the model data for this role.
-
- For example, the following model has a role named "title", which can be accessed
- from the view's delegate:
-
- \qml
- XmlListModel {
- id: xmlModel
- // ...
- XmlRole {
- name: "title"
- query: "title/string()"
- }
- }
- \endqml
-
- \qml
- ListView {
- model: xmlModel
- delegate: Text { text: title }
- }
- \endqml
-*/
-
-/*!
- \qmlproperty string QtQuick.XmlListModel::XmlRole::query
- The relative XPath expression query for this role. The query must be relative; it cannot start
- with a '/'.
-
- For example, if there is an XML document like this:
-
- \quotefile qml/xmlrole.xml
- Here are some valid XPath expressions for XmlRole queries on this document:
-
- \snippet qml/xmlrole.qml 0
- \dots 4
- \snippet qml/xmlrole.qml 1
-
- Accessing the model data for the above roles from a delegate:
-
- \snippet qml/xmlrole.qml 2
-
- See the \l{http://www.w3.org/TR/xpath20/}{W3C XPath 2.0 specification} for more information.
-*/
-
-/*!
- \qmlproperty bool QtQuick.XmlListModel::XmlRole::isKey
- Defines whether this is a key role.
- Key roles are used to determine whether a set of values should
- be updated or added to the XML list model when XmlListModel::reload()
- is called.
-
- \sa XmlListModel
-*/
-
-struct XmlQueryJob
-{
- int queryId;
- QByteArray data;
- QString query;
- QString namespaces;
- QStringList roleQueries;
- QList<void*> roleQueryErrorId; // the ptr to send back if there is an error
- QStringList keyRoleQueries;
- QStringList keyRoleResultsCache;
- QString prefix;
-};
-
-
-class QQuickXmlQueryEngine;
-class QQuickXmlQueryThreadObject : public QObject
-{
- Q_OBJECT
-public:
- QQuickXmlQueryThreadObject(QQuickXmlQueryEngine *);
-
- void processJobs();
- bool event(QEvent *e) override;
-
-private:
- QQuickXmlQueryEngine *m_queryEngine;
-};
-
-
-class QQuickXmlQueryEngine : public QThread
-{
- Q_OBJECT
-public:
- QQuickXmlQueryEngine(QQmlEngine *eng);
- ~QQuickXmlQueryEngine();
-
- int doQuery(QString query, QString namespaces, QByteArray data, QList<QQuickXmlListModelRole *>* roleObjects, QStringList keyRoleResultsCache);
- void abort(int id);
-
- void processJobs();
-
- static QQuickXmlQueryEngine *instance(QQmlEngine *engine);
-
-signals:
- void queryCompleted(const QQuickXmlQueryResult &);
- void error(void*, const QString&);
-
-protected:
- void run() override;
-
-private:
- void processQuery(XmlQueryJob *job);
- void doQueryJob(XmlQueryJob *job, QQuickXmlQueryResult *currentResult);
- void doSubQueryJob(XmlQueryJob *job, QQuickXmlQueryResult *currentResult);
- void getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const;
- void addIndexToRangeList(QList<QQuickXmlListRange> *ranges, int index) const;
-
- QMutex m_mutex;
- QQuickXmlQueryThreadObject *m_threadObject;
- QList<XmlQueryJob> m_jobs;
- QSet<int> m_cancelledJobs;
- QAtomicInt m_queryIds;
-
- QQmlEngine *m_engine;
- QObject *m_eventLoopQuitHack;
-
- static QHash<QQmlEngine *,QQuickXmlQueryEngine*> queryEngines;
- static QMutex queryEnginesMutex;
-};
-QHash<QQmlEngine *,QQuickXmlQueryEngine*> QQuickXmlQueryEngine::queryEngines;
-QMutex QQuickXmlQueryEngine::queryEnginesMutex;
-
-
-QQuickXmlQueryThreadObject::QQuickXmlQueryThreadObject(QQuickXmlQueryEngine *e)
- : m_queryEngine(e)
-{
-}
-
-void QQuickXmlQueryThreadObject::processJobs()
-{
- QCoreApplication::postEvent(this, new QEvent(QEvent::User));
-}
-
-bool QQuickXmlQueryThreadObject::event(QEvent *e)
-{
- if (e->type() == QEvent::User) {
- m_queryEngine->processJobs();
- return true;
- } else {
- return QObject::event(e);
- }
-}
-
-
-
-QQuickXmlQueryEngine::QQuickXmlQueryEngine(QQmlEngine *eng)
-: QThread(eng), m_threadObject(0), m_queryIds(XMLLISTMODEL_CLEAR_ID + 1), m_engine(eng), m_eventLoopQuitHack(0)
-{
- qRegisterMetaType<QQuickXmlQueryResult>("QQuickXmlQueryResult");
-
- m_eventLoopQuitHack = new QObject;
- m_eventLoopQuitHack->moveToThread(this);
- connect(m_eventLoopQuitHack, SIGNAL(destroyed(QObject*)), SLOT(quit()), Qt::DirectConnection);
- start(QThread::IdlePriority);
-}
-
-QQuickXmlQueryEngine::~QQuickXmlQueryEngine()
-{
- queryEnginesMutex.lock();
- queryEngines.remove(m_engine);
- queryEnginesMutex.unlock();
-
- m_eventLoopQuitHack->deleteLater();
- wait();
-}
-
-int QQuickXmlQueryEngine::doQuery(QString query, QString namespaces, QByteArray data, QList<QQuickXmlListModelRole *>* roleObjects, QStringList keyRoleResultsCache) {
- {
- QMutexLocker m1(&m_mutex);
- m_queryIds.ref();
- if (m_queryIds.load() <= 0)
- m_queryIds.store(1);
- }
-
- XmlQueryJob job;
- job.queryId = m_queryIds.load();
- job.data = data;
- job.query = QLatin1String("doc($src)") + query;
- job.namespaces = namespaces;
- job.keyRoleResultsCache = keyRoleResultsCache;
-
- for (int i=0; i<roleObjects->count(); i++) {
- if (!roleObjects->at(i)->isValid()) {
- job.roleQueries << QString();
- continue;
- }
- job.roleQueries << roleObjects->at(i)->query();
- job.roleQueryErrorId << static_cast<void*>(roleObjects->at(i));
- if (roleObjects->at(i)->isKey())
- job.keyRoleQueries << job.roleQueries.last();
- }
-
- {
- QMutexLocker ml(&m_mutex);
- m_jobs.append(job);
- if (m_threadObject)
- m_threadObject->processJobs();
- }
-
- return job.queryId;
-}
-
-void QQuickXmlQueryEngine::abort(int id)
-{
- QMutexLocker ml(&m_mutex);
- if (id != -1)
- m_cancelledJobs.insert(id);
-}
-
-void QQuickXmlQueryEngine::run()
-{
- m_mutex.lock();
- m_threadObject = new QQuickXmlQueryThreadObject(this);
- m_mutex.unlock();
-
- processJobs();
- exec();
-
- delete m_threadObject;
- m_threadObject = 0;
-}
-
-void QQuickXmlQueryEngine::processJobs()
-{
- QMutexLocker locker(&m_mutex);
-
- while (true) {
- if (m_jobs.isEmpty())
- return;
-
- XmlQueryJob currentJob = m_jobs.takeLast();
- while (m_cancelledJobs.remove(currentJob.queryId)) {
- if (m_jobs.isEmpty())
- return;
- currentJob = m_jobs.takeLast();
- }
-
- locker.unlock();
- processQuery(&currentJob);
- locker.relock();
- }
-}
-
-QQuickXmlQueryEngine *QQuickXmlQueryEngine::instance(QQmlEngine *engine)
-{
- queryEnginesMutex.lock();
- QQuickXmlQueryEngine *queryEng = queryEngines.value(engine);
- if (!queryEng) {
- queryEng = new QQuickXmlQueryEngine(engine);
- queryEngines.insert(engine, queryEng);
- }
- queryEnginesMutex.unlock();
-
- return queryEng;
-}
-
-void QQuickXmlQueryEngine::processQuery(XmlQueryJob *job)
-{
- QQuickXmlQueryResult result;
- result.queryId = job->queryId;
- doQueryJob(job, &result);
- doSubQueryJob(job, &result);
-
- {
- QMutexLocker ml(&m_mutex);
- if (m_cancelledJobs.contains(job->queryId)) {
- m_cancelledJobs.remove(job->queryId);
- } else {
- emit queryCompleted(result);
- }
- }
-}
-
-void QQuickXmlQueryEngine::doQueryJob(XmlQueryJob *currentJob, QQuickXmlQueryResult *currentResult)
-{
- Q_ASSERT(currentJob->queryId != -1);
-
- QString r;
- QXmlQuery query;
- QBuffer buffer(&currentJob->data);
- buffer.open(QIODevice::ReadOnly);
- query.bindVariable(QLatin1String("src"), &buffer);
- query.setQuery(currentJob->namespaces + currentJob->query);
- query.evaluateTo(&r);
-
- //always need a single root element
- QByteArray xml = "<dummy:items xmlns:dummy=\"http://qtsotware.com/dummy\">\n" + r.toUtf8() + "</dummy:items>";
- QBuffer b(&xml);
- b.open(QIODevice::ReadOnly);
-
- QString namespaces = QLatin1String("declare namespace dummy=\"http://qtsotware.com/dummy\";\n") + currentJob->namespaces;
- QString prefix = QLatin1String("doc($inputDocument)/dummy:items/*");
-
- //figure out how many items we are dealing with
- int count = -1;
- {
- QXmlResultItems result;
- QXmlQuery countquery;
- countquery.bindVariable(QLatin1String("inputDocument"), &b);
- countquery.setQuery(namespaces + QLatin1String("count(") + prefix + QLatin1Char(')'));
- countquery.evaluateTo(&result);
- QXmlItem item(result.next());
- if (item.isAtomicValue())
- count = item.toAtomicValue().toInt();
- }
-
- currentJob->data = xml;
- currentJob->prefix = namespaces + prefix + QLatin1Char('/');
- currentResult->size = (count > 0 ? count : 0);
-}
-
-void QQuickXmlQueryEngine::getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const
-{
- const QStringList &keysQueries = currentJob.keyRoleQueries;
- QString keysQuery;
- if (keysQueries.count() == 1)
- keysQuery = currentJob.prefix + keysQueries[0];
- else if (keysQueries.count() > 1)
- keysQuery = currentJob.prefix + QLatin1String("concat(") + keysQueries.join(QLatin1Char(',')) + QLatin1Char(')');
-
- if (!keysQuery.isEmpty()) {
- query->setQuery(keysQuery);
- QXmlResultItems resultItems;
- query->evaluateTo(&resultItems);
- QXmlItem item(resultItems.next());
- while (!item.isNull()) {
- values->append(item.toAtomicValue().toString());
- item = resultItems.next();
- }
- }
-}
-
-void QQuickXmlQueryEngine::addIndexToRangeList(QList<QQuickXmlListRange> *ranges, int index) const {
- if (ranges->isEmpty())
- ranges->append(qMakePair(index, 1));
- else if (ranges->last().first + ranges->last().second == index)
- ranges->last().second += 1;
- else
- ranges->append(qMakePair(index, 1));
-}
-
-void QQuickXmlQueryEngine::doSubQueryJob(XmlQueryJob *currentJob, QQuickXmlQueryResult *currentResult)
-{
- Q_ASSERT(currentJob->queryId != -1);
-
- QBuffer b(&currentJob->data);
- b.open(QIODevice::ReadOnly);
-
- QXmlQuery subquery;
- subquery.bindVariable(QLatin1String("inputDocument"), &b);
-
- QStringList keyRoleResults;
- getValuesOfKeyRoles(*currentJob, &keyRoleResults, &subquery);
-
- // See if any values of key roles have been inserted or removed.
-
- if (currentJob->keyRoleResultsCache.isEmpty()) {
- currentResult->inserted << qMakePair(0, currentResult->size);
- } else {
- if (keyRoleResults != currentJob->keyRoleResultsCache) {
- QStringList temp;
- for (int i=0; i<currentJob->keyRoleResultsCache.count(); i++) {
- if (!keyRoleResults.contains(currentJob->keyRoleResultsCache[i]))
- addIndexToRangeList(&currentResult->removed, i);
- else
- temp << currentJob->keyRoleResultsCache[i];
- }
- for (int i=0; i<keyRoleResults.count(); i++) {
- if (temp.count() == i || keyRoleResults[i] != temp[i]) {
- temp.insert(i, keyRoleResults[i]);
- addIndexToRangeList(&currentResult->inserted, i);
- }
- }
- }
- }
- currentResult->keyRoleResultsCache = keyRoleResults;
-
- // Get the new values for each role.
- //### we might be able to condense even further (query for everything in one go)
- const QStringList &queries = currentJob->roleQueries;
- for (int i = 0; i < queries.size(); ++i) {
- QList<QVariant> resultList;
- if (!queries[i].isEmpty()) {
- subquery.setQuery(currentJob->prefix + QLatin1String("(let $v := string(") + queries[i] + QLatin1String(") return if ($v) then ") + queries[i] + QLatin1String(" else \"\")"));
- if (subquery.isValid()) {
- QXmlResultItems resultItems;
- subquery.evaluateTo(&resultItems);
- QXmlItem item(resultItems.next());
- while (!item.isNull()) {
- resultList << item.toAtomicValue(); //### we used to trim strings
- item = resultItems.next();
- }
- } else {
- emit error(currentJob->roleQueryErrorId.at(i), queries[i]);
- }
- }
- //### should warn here if things have gone wrong.
- while (resultList.count() < currentResult->size)
- resultList << QVariant();
- currentResult->data << resultList;
- b.seek(0);
- }
-
- //this method is much slower, but works better for incremental loading
- /*for (int j = 0; j < m_size; ++j) {
- QList<QVariant> resultList;
- for (int i = 0; i < m_roleObjects->size(); ++i) {
- QQuickXmlListModelRole *role = m_roleObjects->at(i);
- subquery.setQuery(m_prefix.arg(j+1) + role->query());
- if (role->isStringList()) {
- QStringList data;
- subquery.evaluateTo(&data);
- resultList << QVariant(data);
- //qDebug() << data;
- } else {
- QString s;
- subquery.evaluateTo(&s);
- if (role->isCData()) {
- //un-escape
- s.replace(QLatin1String("&lt;"), QLatin1String("<"));
- s.replace(QLatin1String("&gt;"), QLatin1String(">"));
- s.replace(QLatin1String("&amp;"), QLatin1String("&"));
- }
- resultList << s.trimmed();
- //qDebug() << s;
- }
- b.seek(0);
- }
- m_modelData << resultList;
- }*/
-}
-
-class QQuickXmlListModelPrivate : public QAbstractItemModelPrivate
-{
- Q_DECLARE_PUBLIC(QQuickXmlListModel)
-public:
- QQuickXmlListModelPrivate()
- : isComponentComplete(true), size(0), highestRole(Qt::UserRole)
- , reply(0), status(QQuickXmlListModel::Null), progress(0.0)
- , queryId(-1), roleObjects(), redirectCount(0) {}
-
-
- void notifyQueryStarted(bool remoteSource) {
- Q_Q(QQuickXmlListModel);
- progress = remoteSource ? 0.0 : 1.0;
- status = QQuickXmlListModel::Loading;
- errorString.clear();
- emit q->progressChanged(progress);
- emit q->statusChanged(status);
- }
-
- void deleteReply() {
- Q_Q(QQuickXmlListModel);
- if (reply) {
- QObject::disconnect(reply, 0, q, 0);
- reply->deleteLater();
- reply = 0;
- }
- }
-
- bool isComponentComplete;
- QUrl src;
- QString xml;
- QString query;
- QString namespaces;
- int size;
- QList<int> roles;
- QStringList roleNames;
- int highestRole;
-
- QNetworkReply *reply;
- QQuickXmlListModel::Status status;
- QString errorString;
- qreal progress;
- int queryId;
- QStringList keyRoleResultsCache;
- QList<QQuickXmlListModelRole *> roleObjects;
-
- static void append_role(QQmlListProperty<QQuickXmlListModelRole> *list, QQuickXmlListModelRole *role);
- static void clear_role(QQmlListProperty<QQuickXmlListModelRole> *list);
- QList<QList<QVariant> > data;
- int redirectCount;
-};
-
-
-void QQuickXmlListModelPrivate::append_role(QQmlListProperty<QQuickXmlListModelRole> *list, QQuickXmlListModelRole *role)
-{
- QQuickXmlListModel *_this = qobject_cast<QQuickXmlListModel *>(list->object);
- if (_this && role) {
- int i = _this->d_func()->roleObjects.count();
- _this->d_func()->roleObjects.append(role);
- if (_this->d_func()->roleNames.contains(role->name())) {
- qmlWarning(role) << QQuickXmlListModel::tr("\"%1\" duplicates a previous role name and will be disabled.").arg(role->name());
- return;
- }
- _this->d_func()->roles.insert(i, _this->d_func()->highestRole);
- _this->d_func()->roleNames.insert(i, role->name());
- ++_this->d_func()->highestRole;
- }
-}
-
-//### clear needs to invalidate any cached data (in data table) as well
-// (and the model should emit the appropriate signals)
-void QQuickXmlListModelPrivate::clear_role(QQmlListProperty<QQuickXmlListModelRole> *list)
-{
- QQuickXmlListModel *_this = static_cast<QQuickXmlListModel *>(list->object);
- _this->d_func()->roles.clear();
- _this->d_func()->roleNames.clear();
- _this->d_func()->roleObjects.clear();
-}
-
-/*!
- \qmltype XmlListModel
- \instantiates QQuickXmlListModel
- \inqmlmodule QtQuick.XmlListModel
- \brief For specifying a read-only model using XPath expressions
- \ingroup qtquick-models
-
-
- To use this element, you will need to import the module with the following line:
- \code
- import QtQuick.XmlListModel 2.0
- \endcode
-
- XmlListModel is used to create a read-only model from XML data. It can be used as a data source
- for view elements (such as ListView, PathView, GridView) and other elements that interact with model
- data (such as \l Repeater).
-
- For example, if there is a XML document at http://www.mysite.com/feed.xml like this:
-
- \code
- <?xml version="1.0" encoding="utf-8"?>
- <rss version="2.0">
- ...
- <channel>
- <item>
- <title>A blog post</title>
- <pubDate>Sat, 07 Sep 2010 10:00:01 GMT</pubDate>
- </item>
- <item>
- <title>Another blog post</title>
- <pubDate>Sat, 07 Sep 2010 15:35:01 GMT</pubDate>
- </item>
- </channel>
- </rss>
- \endcode
-
- A XmlListModel could create a model from this data, like this:
-
- \qml
- import QtQuick 2.0
- import QtQuick.XmlListModel 2.0
-
- XmlListModel {
- id: xmlModel
- source: "http://www.mysite.com/feed.xml"
- query: "/rss/channel/item"
-
- XmlRole { name: "title"; query: "title/string()" }
- XmlRole { name: "pubDate"; query: "pubDate/string()" }
- }
- \endqml
-
- The \l {XmlListModel::query}{query} value of "/rss/channel/item" specifies that the XmlListModel should generate
- a model item for each \c <item> in the XML document.
-
- The XmlRole objects define the
- model item attributes. Here, each model item will have \c title and \c pubDate
- attributes that match the \c title and \c pubDate values of its corresponding \c <item>.
- (See \l XmlRole::query for more examples of valid XPath expressions for XmlRole.)
-
- The model could be used in a ListView, like this:
-
- \qml
- ListView {
- width: 180; height: 300
- model: xmlModel
- delegate: Text { text: title + ": " + pubDate }
- }
- \endqml
-
- \image qml-xmllistmodel-example.png
-
- The XmlListModel data is loaded asynchronously, and \l status
- is set to \c XmlListModel.Ready when loading is complete.
- Note this means when XmlListModel is used for a view, the view is not
- populated until the model is loaded.
-
-
- \section2 Using key XML roles
-
- You can define certain roles as "keys" so that when reload() is called,
- the model will only add and refresh data that contains new values for
- these keys.
-
- For example, if above role for "pubDate" was defined like this instead:
-
- \qml
- XmlRole { name: "pubDate"; query: "pubDate/string()"; isKey: true }
- \endqml
-
- Then when reload() is called, the model will only add and reload
- items with a "pubDate" value that is not already
- present in the model.
-
- This is useful when displaying the contents of XML documents that
- are incrementally updated (such as RSS feeds) to avoid repainting the
- entire contents of a model in a view.
-
- If multiple key roles are specified, the model only adds and reload items
- with a combined value of all key roles that is not already present in
- the model.
-
- \sa {Qt Quick Demo - RSS News}
-*/
-
-QQuickXmlListModel::QQuickXmlListModel(QObject *parent)
- : QAbstractListModel(*(new QQuickXmlListModelPrivate), parent)
-{
-}
-
-QQuickXmlListModel::~QQuickXmlListModel()
-{
-}
-
-/*!
- \qmlproperty list<XmlRole> QtQuick.XmlListModel::XmlListModel::roles
-
- The roles to make available for this model.
-*/
-QQmlListProperty<QQuickXmlListModelRole> QQuickXmlListModel::roleObjects()
-{
- Q_D(QQuickXmlListModel);
- QQmlListProperty<QQuickXmlListModelRole> list(this, d->roleObjects);
- list.append = &QQuickXmlListModelPrivate::append_role;
- list.clear = &QQuickXmlListModelPrivate::clear_role;
- return list;
-}
-
-QModelIndex QQuickXmlListModel::index(int row, int column, const QModelIndex &parent) const
-{
- Q_D(const QQuickXmlListModel);
- return !parent.isValid() && column == 0 && row >= 0 && row < d->size
- ? createIndex(row, column)
- : QModelIndex();
-}
-
-int QQuickXmlListModel::rowCount(const QModelIndex &parent) const
-{
- Q_D(const QQuickXmlListModel);
- return !parent.isValid() ? d->size : 0;
-}
-
-QVariant QQuickXmlListModel::data(const QModelIndex &index, int role) const
-{
- Q_D(const QQuickXmlListModel);
- const int roleIndex = d->roles.indexOf(role);
- return (roleIndex == -1 || !index.isValid())
- ? QVariant()
- : d->data.value(roleIndex).value(index.row());
-}
-
-QHash<int, QByteArray> QQuickXmlListModel::roleNames() const
-{
- Q_D(const QQuickXmlListModel);
- QHash<int,QByteArray> roleNames;
- for (int i = 0; i < d->roles.count(); ++i)
- roleNames.insert(d->roles.at(i), d->roleNames.at(i).toUtf8());
- return roleNames;
-}
-
-/*!
- \qmlproperty int QtQuick.XmlListModel::XmlListModel::count
- The number of data entries in the model.
-*/
-int QQuickXmlListModel::count() const
-{
- Q_D(const QQuickXmlListModel);
- return d->size;
-}
-
-/*!
- \qmlproperty url QtQuick.XmlListModel::XmlListModel::source
- The location of the XML data source.
-
- If both \c source and \l xml are set, \l xml is used.
-*/
-QUrl QQuickXmlListModel::source() const
-{
- Q_D(const QQuickXmlListModel);
- return d->src;
-}
-
-void QQuickXmlListModel::setSource(const QUrl &src)
-{
- Q_D(QQuickXmlListModel);
- if (d->src != src) {
- d->src = src;
- if (d->xml.isEmpty()) // src is only used if d->xml is not set
- reload();
- emit sourceChanged();
- }
-}
-
-/*!
- \qmlproperty string QtQuick.XmlListModel::XmlListModel::xml
- This property holds the XML data for this model, if set.
-
- The text is assumed to be UTF-8 encoded.
-
- If both \l source and \c xml are set, \c xml is used.
-*/
-QString QQuickXmlListModel::xml() const
-{
- Q_D(const QQuickXmlListModel);
- return d->xml;
-}
-
-void QQuickXmlListModel::setXml(const QString &xml)
-{
- Q_D(QQuickXmlListModel);
- if (d->xml != xml) {
- d->xml = xml;
- reload();
- emit xmlChanged();
- }
-}
-
-/*!
- \qmlproperty string QtQuick.XmlListModel::XmlListModel::query
- An absolute XPath query representing the base query for creating model items
- from this model's XmlRole objects. The query should start with '/' or '//'.
-*/
-QString QQuickXmlListModel::query() const
-{
- Q_D(const QQuickXmlListModel);
- return d->query;
-}
-
-void QQuickXmlListModel::setQuery(const QString &query)
-{
- Q_D(QQuickXmlListModel);
- if (!query.startsWith(QLatin1Char('/'))) {
- qmlWarning(this) << QCoreApplication::translate("QQuickXmlRoleList", "An XmlListModel query must start with '/' or \"//\"");
- return;
- }
-
- if (d->query != query) {
- d->query = query;
- reload();
- emit queryChanged();
- }
-}
-
-/*!
- \qmlproperty string QtQuick.XmlListModel::XmlListModel::namespaceDeclarations
- The namespace declarations to be used in the XPath queries.
-
- The namespaces should be declared as in XQuery. For example, if a requested document
- at http://mysite.com/feed.xml uses the namespace "http://www.w3.org/2005/Atom",
- this can be declared as the default namespace:
-
- \qml
- XmlListModel {
- source: "http://mysite.com/feed.xml"
- query: "/feed/entry"
- namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';"
-
- XmlRole { name: "title"; query: "title/string()" }
- }
- \endqml
-*/
-QString QQuickXmlListModel::namespaceDeclarations() const
-{
- Q_D(const QQuickXmlListModel);
- return d->namespaces;
-}
-
-void QQuickXmlListModel::setNamespaceDeclarations(const QString &declarations)
-{
- Q_D(QQuickXmlListModel);
- if (d->namespaces != declarations) {
- d->namespaces = declarations;
- reload();
- emit namespaceDeclarationsChanged();
- }
-}
-
-/*!
- \qmlmethod object QtQuick.XmlListModel::XmlListModel::get(int index)
-
- Returns the item at \a index in the model.
-
- For example, for a model like this:
-
- \qml
- XmlListModel {
- id: model
- source: "http://mysite.com/feed.xml"
- query: "/feed/entry"
- XmlRole { name: "title"; query: "title/string()" }
- }
- \endqml
-
- This will access the \c title value for the first item in the model:
-
- \js
- var title = model.get(0).title;
- \endjs
-*/
-QQmlV4Handle QQuickXmlListModel::get(int index) const
-{
- // Must be called with a context and handle scope
- Q_D(const QQuickXmlListModel);
-
- if (index < 0 || index >= count())
- return QQmlV4Handle(Encode::undefined());
-
- QQmlEngine *engine = qmlContext(this)->engine();
- QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
- ExecutionEngine *v4engine = QV8Engine::getV4(v8engine);
- Scope scope(v4engine);
- Scoped<Object> o(scope, v4engine->newObject());
- ScopedString name(scope);
- ScopedValue value(scope);
- for (int ii = 0; ii < d->roleObjects.count(); ++ii) {
- name = v4engine->newIdentifier(d->roleObjects[ii]->name());
- value = v4engine->fromVariant(d->data.value(ii).value(index));
- o->insertMember(name.getPointer(), value);
- }
-
- return QQmlV4Handle(o);
-}
-
-/*!
- \qmlproperty enumeration QtQuick.XmlListModel::XmlListModel::status
- Specifies the model loading status, which can be one of the following:
-
- \list
- \li XmlListModel.Null - No XML data has been set for this model.
- \li XmlListModel.Ready - The XML data has been loaded into the model.
- \li XmlListModel.Loading - The model is in the process of reading and loading XML data.
- \li XmlListModel.Error - An error occurred while the model was loading. See errorString() for details
- about the error.
- \endlist
-
- \sa progress
-
-*/
-QQuickXmlListModel::Status QQuickXmlListModel::status() const
-{
- Q_D(const QQuickXmlListModel);
- return d->status;
-}
-
-/*!
- \qmlproperty real QtQuick.XmlListModel::XmlListModel::progress
-
- This indicates the current progress of the downloading of the XML data
- source. This value ranges from 0.0 (no data downloaded) to
- 1.0 (all data downloaded). If the XML data is not from a remote source,
- the progress becomes 1.0 as soon as the data is read.
-
- Note that when the progress is 1.0, the XML data has been downloaded, but
- it is yet to be loaded into the model at this point. Use the status
- property to find out when the XML data has been read and loaded into
- the model.
-
- \sa status, source
-*/
-qreal QQuickXmlListModel::progress() const
-{
- Q_D(const QQuickXmlListModel);
- return d->progress;
-}
-
-/*!
- \qmlmethod QtQuick.XmlListModel::XmlListModel::errorString()
-
- Returns a string description of the last error that occurred
- if \l status is XmlListModel::Error.
-*/
-QString QQuickXmlListModel::errorString() const
-{
- Q_D(const QQuickXmlListModel);
- return d->errorString;
-}
-
-void QQuickXmlListModel::classBegin()
-{
- Q_D(QQuickXmlListModel);
- d->isComponentComplete = false;
-
- QQuickXmlQueryEngine *queryEngine = QQuickXmlQueryEngine::instance(qmlEngine(this));
- connect(queryEngine, SIGNAL(queryCompleted(QQuickXmlQueryResult)),
- SLOT(queryCompleted(QQuickXmlQueryResult)));
- connect(queryEngine, SIGNAL(error(void*,QString)),
- SLOT(queryError(void*,QString)));
-}
-
-void QQuickXmlListModel::componentComplete()
-{
- Q_D(QQuickXmlListModel);
- d->isComponentComplete = true;
- reload();
-}
-
-/*!
- \qmlmethod QtQuick.XmlListModel::XmlListModel::reload()
-
- Reloads the model.
-
- If no key roles have been specified, all existing model
- data is removed, and the model is rebuilt from scratch.
-
- Otherwise, items are only added if the model does not already
- contain items with matching key role values.
-
- \sa {Using key XML roles}, XmlRole::isKey
-*/
-void QQuickXmlListModel::reload()
-{
- Q_D(QQuickXmlListModel);
-
- if (!d->isComponentComplete)
- return;
-
- QQuickXmlQueryEngine::instance(qmlEngine(this))->abort(d->queryId);
- d->queryId = -1;
-
- if (d->size < 0)
- d->size = 0;
-
- if (d->reply) {
- d->reply->abort();
- d->deleteReply();
- }
-
- if (!d->xml.isEmpty()) {
- d->queryId = QQuickXmlQueryEngine::instance(qmlEngine(this))->doQuery(d->query, d->namespaces, d->xml.toUtf8(), &d->roleObjects, d->keyRoleResultsCache);
- d->notifyQueryStarted(false);
-
- } else if (d->src.isEmpty()) {
- d->queryId = XMLLISTMODEL_CLEAR_ID;
- d->notifyQueryStarted(false);
- QTimer::singleShot(0, this, SLOT(dataCleared()));
-
- } else {
- d->notifyQueryStarted(true);
- QNetworkRequest req(d->src);
- req.setRawHeader("Accept", "application/xml,*/*");
- d->reply = qmlContext(this)->engine()->networkAccessManager()->get(req);
- QObject::connect(d->reply, SIGNAL(finished()), this, SLOT(requestFinished()));
- QObject::connect(d->reply, SIGNAL(downloadProgress(qint64,qint64)),
- this, SLOT(requestProgress(qint64,qint64)));
- }
-}
-
-#define XMLLISTMODEL_MAX_REDIRECT 16
-
-void QQuickXmlListModel::requestFinished()
-{
- Q_D(QQuickXmlListModel);
-
- d->redirectCount++;
- if (d->redirectCount < XMLLISTMODEL_MAX_REDIRECT) {
- QVariant redirect = d->reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
- if (redirect.isValid()) {
- QUrl url = d->reply->url().resolved(redirect.toUrl());
- d->deleteReply();
- setSource(url);
- return;
- }
- }
- d->redirectCount = 0;
-
- if (d->reply->error() != QNetworkReply::NoError) {
- d->errorString = d->reply->errorString();
- d->deleteReply();
-
- if (d->size > 0) {
- beginRemoveRows(QModelIndex(), 0, d->size - 1);
- d->data.clear();
- d->size = 0;
- endRemoveRows();
- emit countChanged();
- }
-
- d->status = Error;
- d->queryId = -1;
- emit statusChanged(d->status);
- } else {
- QByteArray data = d->reply->readAll();
- if (data.isEmpty()) {
- d->queryId = XMLLISTMODEL_CLEAR_ID;
- QTimer::singleShot(0, this, SLOT(dataCleared()));
- } else {
- d->queryId = QQuickXmlQueryEngine::instance(qmlEngine(this))->doQuery(d->query, d->namespaces, data, &d->roleObjects, d->keyRoleResultsCache);
- }
- d->deleteReply();
-
- d->progress = 1.0;
- emit progressChanged(d->progress);
- }
-}
-
-void QQuickXmlListModel::requestProgress(qint64 received, qint64 total)
-{
- Q_D(QQuickXmlListModel);
- if (d->status == Loading && total > 0) {
- d->progress = qreal(received)/total;
- emit progressChanged(d->progress);
- }
-}
-
-void QQuickXmlListModel::dataCleared()
-{
- Q_D(QQuickXmlListModel);
- QQuickXmlQueryResult r;
- r.queryId = XMLLISTMODEL_CLEAR_ID;
- r.size = 0;
- r.removed << qMakePair(0, count());
- r.keyRoleResultsCache = d->keyRoleResultsCache;
- queryCompleted(r);
-}
-
-void QQuickXmlListModel::queryError(void* object, const QString& error)
-{
- // Be extra careful, object may no longer exist, it's just an ID.
- Q_D(QQuickXmlListModel);
- for (int i=0; i<d->roleObjects.count(); i++) {
- if (d->roleObjects.at(i) == static_cast<QQuickXmlListModelRole*>(object)) {
- qmlWarning(d->roleObjects.at(i)) << QQuickXmlListModel::tr("invalid query: \"%1\"").arg(error);
- return;
- }
- }
- qmlWarning(this) << QQuickXmlListModel::tr("invalid query: \"%1\"").arg(error);
-}
-
-void QQuickXmlListModel::queryCompleted(const QQuickXmlQueryResult &result)
-{
- Q_D(QQuickXmlListModel);
- if (result.queryId != d->queryId)
- return;
-
- int origCount = d->size;
- bool sizeChanged = result.size != d->size;
-
- d->size = result.size;
- d->data = result.data;
- d->keyRoleResultsCache = result.keyRoleResultsCache;
- if (d->src.isEmpty() && d->xml.isEmpty())
- d->status = Null;
- else
- d->status = Ready;
- d->errorString.clear();
- d->queryId = -1;
-
- bool hasKeys = false;
- for (int i=0; i<d->roleObjects.count(); i++) {
- if (d->roleObjects[i]->isKey()) {
- hasKeys = true;
- break;
- }
- }
- if (!hasKeys) {
- if (origCount > 0) {
- beginRemoveRows(QModelIndex(), 0, origCount - 1);
- endRemoveRows();
- }
- if (d->size > 0) {
- beginInsertRows(QModelIndex(), 0, d->size - 1);
- endInsertRows();
- }
- } else {
- for (int i=0; i<result.removed.count(); i++) {
- const int index = result.removed[i].first;
- const int count = result.removed[i].second;
- if (count > 0) {
- beginRemoveRows(QModelIndex(), index, index + count - 1);
- endRemoveRows();
- }
- }
- for (int i=0; i<result.inserted.count(); i++) {
- const int index = result.inserted[i].first;
- const int count = result.inserted[i].second;
- if (count > 0) {
- beginInsertRows(QModelIndex(), index, index + count - 1);
- endInsertRows();
- }
- }
- }
- if (sizeChanged)
- emit countChanged();
-
- emit statusChanged(d->status);
-}
-
-QT_END_NAMESPACE
-
-#include <qqmlxmllistmodel.moc>
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel_p.h b/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
deleted file mode 100644
index e6a0898bb9..0000000000
--- a/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml 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 QQUICKXMLLISTMODEL_H
-#define QQUICKXMLLISTMODEL_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 <qqml.h>
-#include <qqmlinfo.h>
-
-#include <QtCore/qurl.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qabstractitemmodel.h>
-#include <private/qv8engine_p.h>
-
-QT_BEGIN_NAMESPACE
-
-
-class QQmlContext;
-class QQuickXmlListModelRole;
-class QQuickXmlListModelPrivate;
-
-struct QQuickXmlQueryResult {
- int queryId;
- int size;
- QList<QList<QVariant> > data;
- QList<QPair<int, int> > inserted;
- QList<QPair<int, int> > removed;
- QStringList keyRoleResultsCache;
-};
-
-class QQuickXmlListModel : public QAbstractListModel, public QQmlParserStatus
-{
- Q_OBJECT
- Q_INTERFACES(QQmlParserStatus)
-
- Q_PROPERTY(Status status READ status NOTIFY statusChanged)
- Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
- Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
- Q_PROPERTY(QString xml READ xml WRITE setXml NOTIFY xmlChanged)
- Q_PROPERTY(QString query READ query WRITE setQuery NOTIFY queryChanged)
- Q_PROPERTY(QString namespaceDeclarations READ namespaceDeclarations WRITE setNamespaceDeclarations NOTIFY namespaceDeclarationsChanged)
- Q_PROPERTY(QQmlListProperty<QQuickXmlListModelRole> roles READ roleObjects)
- Q_PROPERTY(int count READ count NOTIFY countChanged)
- Q_CLASSINFO("DefaultProperty", "roles")
-
-public:
- QQuickXmlListModel(QObject *parent = 0);
- ~QQuickXmlListModel();
-
- QModelIndex index(int row, int column, const QModelIndex &parent) const override;
- int rowCount(const QModelIndex &parent) const override;
- QVariant data(const QModelIndex &index, int role) const override;
- QHash<int, QByteArray> roleNames() const override;
-
- int count() const;
-
- QQmlListProperty<QQuickXmlListModelRole> roleObjects();
-
- QUrl source() const;
- void setSource(const QUrl&);
-
- QString xml() const;
- void setXml(const QString&);
-
- QString query() const;
- void setQuery(const QString&);
-
- QString namespaceDeclarations() const;
- void setNamespaceDeclarations(const QString&);
-
- Q_INVOKABLE QQmlV4Handle get(int index) const;
-
- enum Status { Null, Ready, Loading, Error };
- Q_ENUM(Status)
- Status status() const;
- qreal progress() const;
-
- Q_INVOKABLE QString errorString() const;
-
- void classBegin() override;
- void componentComplete() override;
-
-Q_SIGNALS:
- void statusChanged(QQuickXmlListModel::Status);
- void progressChanged(qreal progress);
- void countChanged();
- void sourceChanged();
- void xmlChanged();
- void queryChanged();
- void namespaceDeclarationsChanged();
-
-public Q_SLOTS:
- // ### need to use/expose Expiry to guess when to call this?
- // ### property to auto-call this on reasonable Expiry?
- // ### LastModified/Age also useful to guess.
- // ### Probably also applies to other network-requesting types.
- void reload();
-
-private Q_SLOTS:
- void requestFinished();
- void requestProgress(qint64,qint64);
- void dataCleared();
- void queryCompleted(const QQuickXmlQueryResult &);
- void queryError(void* object, const QString& error);
-
-private:
- Q_DECLARE_PRIVATE(QQuickXmlListModel)
- Q_DISABLE_COPY(QQuickXmlListModel)
-};
-
-class QQuickXmlListModelRole : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
- Q_PROPERTY(QString query READ query WRITE setQuery NOTIFY queryChanged)
- Q_PROPERTY(bool isKey READ isKey WRITE setIsKey NOTIFY isKeyChanged)
-public:
- QQuickXmlListModelRole() : m_isKey(false) {}
- ~QQuickXmlListModelRole() {}
-
- QString name() const { return m_name; }
- void setName(const QString &name) {
- if (name == m_name)
- return;
- m_name = name;
- Q_EMIT nameChanged();
- }
-
- QString query() const { return m_query; }
- void setQuery(const QString &query)
- {
- if (query.startsWith(QLatin1Char('/'))) {
- qmlWarning(this) << tr("An XmlRole query must not start with '/'");
- return;
- }
- if (m_query == query)
- return;
- m_query = query;
- Q_EMIT queryChanged();
- }
-
- bool isKey() const { return m_isKey; }
- void setIsKey(bool b) {
- if (m_isKey == b)
- return;
- m_isKey = b;
- Q_EMIT isKeyChanged();
- }
-
- bool isValid() const {
- return !m_name.isEmpty() && !m_query.isEmpty();
- }
-
-Q_SIGNALS:
- void nameChanged();
- void queryChanged();
- void isKeyChanged();
-
-private:
- QString m_name;
- QString m_query;
- bool m_isKey;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickXmlListModel)
-QML_DECLARE_TYPE(QQuickXmlListModelRole)
-
-#endif // QQUICKXMLLISTMODEL_H
diff --git a/src/imports/xmllistmodel/xmllistmodel.pro b/src/imports/xmllistmodel/xmllistmodel.pro
deleted file mode 100644
index 2308f26d1b..0000000000
--- a/src/imports/xmllistmodel/xmllistmodel.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CXX_MODULE = qml
-TARGET = qmlxmllistmodelplugin
-TARGETPATH = QtQuick/XmlListModel
-IMPORT_VERSION = 2.0
-
-QT = network xmlpatterns qml-private core-private
-
-SOURCES += qqmlxmllistmodel.cpp plugin.cpp
-HEADERS += qqmlxmllistmodel_p.h
-
-load(qml_plugin)