aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qml
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-04 01:00:22 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-10-04 11:29:16 +0200
commit9c7121df1579d38c7f4136da6146d7acae8fedcc (patch)
tree0917e293d83b4c1ce635cf65185e6ad98fe66519 /tools/qml
parentf529d38103a6c1c5c7b76ad92e0e5641719e369e (diff)
parentc211b93bb87308601fe1c808634eb648d1949c40 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: src/imports/qtquick2/plugins.qmltypes src/quick/items/qquickitemsmodule.cpp Change-Id: I841c65c9c131354788b4f3fcfe3d7ed27be316d5
Diffstat (limited to 'tools/qml')
-rw-r--r--tools/qml/main.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index a57b2c0db2..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;
}
@@ -597,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();