From 7d545e22f1954ea94a581179cdb7b77d1ffe4567 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sun, 28 Dec 2014 20:37:04 +0100 Subject: [PATCH] Set visibility on mainItem to match Dialog Otherwise we can have an invisible dialog in which the items think they are visible. QtQuick is smart enough to not redraw anything if the window isn't visible, but a lot of bits of our code check the visibility flag to enable/disable animations. These animation timers do still trigger when the window isn't visible which wastes CPU cycles. We are already meddling with the visibility flag so this shouldn't have too much impact. Change-Id: I92b969e60b4fdbe4ff2c70f9cce6e3408482a862 --- src/plasmaquick/dialog.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plasmaquick/dialog.cpp b/src/plasmaquick/dialog.cpp index 1c07ab0a1..74c68a6ec 100644 --- a/src/plasmaquick/dialog.cpp +++ b/src/plasmaquick/dialog.cpp @@ -237,6 +237,10 @@ void DialogPrivate::updateTheme() void DialogPrivate::updateVisibility(bool visible) { + if (mainItem) { + mainItem->setVisible(visible); + } + if (visible) { if (visualParent && visualParent->window()) { q->setTransientParent(visualParent->window()); @@ -269,6 +273,7 @@ void DialogPrivate::updateVisibility(bool visible) } } + if (!(q->flags() & Qt::ToolTip)) { KWindowEffects::SlideFromLocation slideLocation = KWindowEffects::NoEdge; @@ -675,7 +680,7 @@ void Dialog::setMainItem(QQuickItem *mainItem) d->mainItem = mainItem; if (mainItem) { - d->mainItem->setVisible(true); + d->mainItem->setVisible(isVisible()); mainItem->setParentItem(contentItem()); connect(mainItem, SIGNAL(widthChanged()), this, SLOT(slotMainItemSizeChanged()));