aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qml/main.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-01-17 15:34:36 +0100
committerUlf Hermann <ulf.hermann@qt.io>2023-01-23 10:08:24 +0100
commit1e3bf94b251ee8e8fcf156514df0c3a9b385d5d2 (patch)
tree28ba0a76feb1859efe4ebf13185e9e72306eef19 /tools/qml/main.cpp
parentaa7f0b9731f4650ad57a4023374e7ddaeb168a7f (diff)
qml: Fix object counting
We're not actually interested in whether an object is a window, and we don't really care how many objects are created. The only thing we need to know is whether at least one object is alive after all files have been processed. Pick-to: 6.5 Fixes: QTBUG-110112 Change-Id: I8d79359f3fb7ec5a54545dc5858cf310b0f52935 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools/qml/main.cpp')
-rw-r--r--tools/qml/main.cpp20
1 files changed, 3 insertions, 17 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 9ad2abe781..ae5596e000 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -234,16 +234,14 @@ public Q_SLOTS:
{
Q_UNUSED(url);
if (o) {
- checkForWindow(o);
+ ++createdObjects;
if (conf && qae)
for (PartialScene *ps : std::as_const(conf->completers))
if (o->inherits(ps->itemType().toUtf8().constData()))
contain(o, ps->container());
}
- if (haveWindow)
- return;
- if (! --expectedFileCount) {
+ if (!--expectedFileCount && !createdObjects) {
printf("qml: Did not load any objects, exiting.\n");
exit(2);
QCoreApplication::exit(2);
@@ -262,11 +260,10 @@ public Q_SLOTS:
private:
void contain(QObject *o, const QUrl &containPath);
- void checkForWindow(QObject *o);
private:
- bool haveWindow = false;
int expectedFileCount;
+ int createdObjects = 0;
};
void LoadWatcher::contain(QObject *o, const QUrl &containPath)
@@ -276,7 +273,6 @@ void LoadWatcher::contain(QObject *o, const QUrl &containPath)
if (!o2)
return;
o2->setParent(this);
- checkForWindow(o2);
bool success = false;
int idx;
if ((idx = o2->metaObject()->indexOfProperty("containedObject")) != -1)
@@ -285,16 +281,6 @@ void LoadWatcher::contain(QObject *o, const QUrl &containPath)
o->setParent(o2); // Set QObject parent, and assume container will react as needed
}
-void LoadWatcher::checkForWindow(QObject *o)
-{
-#if defined(QT_GUI_LIB)
- if (o->isWindowType() && o->inherits("QQuickWindow"))
- haveWindow = true;
-#else
- Q_UNUSED(o);
-#endif // QT_GUI_LIB
-}
-
void quietMessageHandler(QtMsgType type, const QMessageLogContext &ctxt, const QString &msg)
{
Q_UNUSED(ctxt);