aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickapplicationwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicktemplates2/qquickapplicationwindow.cpp')
-rw-r--r--src/quicktemplates2/qquickapplicationwindow.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp
index 94b0de98..687b4233 100644
--- a/src/quicktemplates2/qquickapplicationwindow.cpp
+++ b/src/quicktemplates2/qquickapplicationwindow.cpp
@@ -166,6 +166,7 @@ public:
static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj);
+ void cancelBackground();
void executeBackground(bool complete = false);
bool complete;
@@ -334,13 +335,19 @@ void QQuickApplicationWindowPrivate::contentData_append(QQmlListProperty<QObject
static inline QString backgroundName() { return QStringLiteral("background"); }
+void QQuickApplicationWindowPrivate::cancelBackground()
+{
+ Q_Q(QQuickApplicationWindow);
+ quickCancelDeferred(q, backgroundName());
+}
+
void QQuickApplicationWindowPrivate::executeBackground(bool complete)
{
Q_Q(QQuickApplicationWindow);
if (background.wasExecuted())
return;
- if (!background)
+ if (!background || complete)
quickBeginDeferred(q, backgroundName(), background);
if (complete)
quickCompleteDeferred(q, backgroundName(), background);
@@ -404,6 +411,9 @@ void QQuickApplicationWindow::setBackground(QQuickItem *background)
if (d->background == background)
return;
+ if (!d->background.isExecuting())
+ d->cancelBackground();
+
delete d->background;
d->background = background;
if (background) {