aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qml
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-10-14 18:46:38 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-10-14 19:02:37 +0200
commitc2f8b9535d34da6948ccf45b7d5fd90de2f1bc9e (patch)
treec6f7e058a985d7c18b51cadc76283caf555071c9 /tools/qml
parent9e633bbda7608ac0231809e2a6a97ae8f2d849d6 (diff)
parent803f18f02e5609a1ca00a5b78ea6d3613d44e1a0 (diff)
Merge remote-tracking branch 'origin/dev' into wip/cmake
Removed dependencies.yaml because we don't use it yet in wip/cmake. Fixed conflict in qmlcachegen.cpp. Change-Id: Ie1060c737bee1daa85779903598e5b6d5020d922
Diffstat (limited to 'tools/qml')
-rw-r--r--tools/qml/conf.h3
-rw-r--r--tools/qml/main.cpp17
2 files changed, 12 insertions, 8 deletions
diff --git a/tools/qml/conf.h b/tools/qml/conf.h
index 0c9d8613a0..e83d63cba5 100644
--- a/tools/qml/conf.h
+++ b/tools/qml/conf.h
@@ -30,6 +30,7 @@
#include <QtQml/QQmlContext>
#include <QtQml/QQmlListProperty>
+#include <QtQml/qqml.h>
#include <QObject>
#include <QUrl>
@@ -38,6 +39,7 @@ class PartialScene : public QObject
Q_OBJECT
Q_PROPERTY(QUrl container READ container WRITE setContainer NOTIFY containerChanged)
Q_PROPERTY(QString itemType READ itemType WRITE setItemType NOTIFY itemTypeChanged)
+ QML_ELEMENT
public:
PartialScene(QObject *parent = 0) : QObject(parent)
{}
@@ -72,6 +74,7 @@ class Config : public QObject
Q_OBJECT
Q_PROPERTY(QQmlListProperty<PartialScene> sceneCompleters READ sceneCompleters)
Q_CLASSINFO("DefaultProperty", "sceneCompleters")
+ QML_NAMED_ELEMENT(Configuration)
public:
Config (QObject* parent=0) : QObject(parent)
{}
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 9edc90e050..f7d7b98277 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -60,6 +60,7 @@
#include <qqml.h>
#include <qqmldebug.h>
+#include <private/qmemory_p.h>
#include <private/qtqmlglobal_p.h>
#if QT_CONFIG(qml_animation)
#include <private/qabstractanimation_p.h>
@@ -68,6 +69,7 @@
#include <cstdio>
#include <cstring>
#include <cstdlib>
+#include <memory>
#define FILE_OPEN_EVENT_WAIT_TIME 3000 // ms
@@ -398,23 +400,23 @@ static void loadDummyDataFiles(QQmlEngine &engine, const QString& directory)
int main(int argc, char *argv[])
{
getAppFlags(argc, argv);
- QCoreApplication *app = nullptr;
+ std::unique_ptr<QCoreApplication> app;
switch (applicationType) {
#ifdef QT_GUI_LIB
case QmlApplicationTypeGui:
- app = new LoaderApplication(argc, argv);
+ app = qt_make_unique<LoaderApplication>(argc, argv);
break;
#ifdef QT_WIDGETS_LIB
case QmlApplicationTypeWidget:
- app = new QApplication(argc, argv);
- static_cast<QApplication *>(app)->setWindowIcon(QIcon(iconResourcePath));
+ app = qt_make_unique<QApplication>(argc, argv);
+ static_cast<QApplication *>(app.get())->setWindowIcon(QIcon(iconResourcePath));
break;
#endif // QT_WIDGETS_LIB
#endif // QT_GUI_LIB
case QmlApplicationTypeCore:
Q_FALLTHROUGH();
default: // QmlApplicationTypeUnknown: not allowed, but we'll exit after checking apptypeOption below
- app = new QCoreApplication(argc, argv);
+ app = qt_make_unique<QCoreApplication>(argc, argv);
break;
}
@@ -423,8 +425,7 @@ int main(int argc, char *argv[])
app->setOrganizationDomain("qt-project.org");
QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR));
- qmlRegisterType<Config>("QmlRuntime.Config", 1, 0, "Configuration");
- qmlRegisterType<PartialScene>("QmlRuntime.Config", 1, 0, "PartialScene");
+ qmlRegisterTypesAndRevisions<Config, PartialScene>("QmlRuntime.Config", 1);
QQmlApplicationEngine e;
QStringList files;
QString confFile;
@@ -598,7 +599,7 @@ int main(int argc, char *argv[])
if (files.count() <= 0) {
#if defined(Q_OS_DARWIN)
if (applicationType == QmlApplicationTypeGui)
- exitTimerId = static_cast<LoaderApplication *>(app)->startTimer(FILE_OPEN_EVENT_WAIT_TIME);
+ exitTimerId = static_cast<LoaderApplication *>(app.get())->startTimer(FILE_OPEN_EVENT_WAIT_TIME);
else
#endif
noFilesGiven();