Change in plasma-framework[master]: Set visibility on mainItem to match Dialog

David Edmundson (Code Review) noreply at kde.org
Sun Dec 28 19:37:39 UTC 2014


David Edmundson has uploaded a new change for review.

  https://gerrit.vesnicky.cesnet.cz/r/282

Change subject: Set visibility on mainItem to match Dialog
......................................................................

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
---
M src/plasmaquick/dialog.cpp
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.vesnicky.cesnet.cz:29418/plasma-framework refs/changes/82/282/1

diff --git a/src/plasmaquick/dialog.cpp b/src/plasmaquick/dialog.cpp
index 1c07ab0..74c68a6 100644
--- a/src/plasmaquick/dialog.cpp
+++ b/src/plasmaquick/dialog.cpp
@@ -237,6 +237,10 @@
 
 void DialogPrivate::updateVisibility(bool visible)
 {
+    if (mainItem) {
+        mainItem->setVisible(visible);
+    }
+
     if (visible) {
         if (visualParent && visualParent->window()) {
             q->setTransientParent(visualParent->window());
@@ -268,6 +272,7 @@
             }
         }
     }
+
 
     if (!(q->flags() & Qt::ToolTip)) {
         KWindowEffects::SlideFromLocation slideLocation = KWindowEffects::NoEdge;
@@ -675,7 +680,7 @@
         d->mainItem = mainItem;
 
         if (mainItem) {
-            d->mainItem->setVisible(true);
+            d->mainItem->setVisible(isVisible());
             mainItem->setParentItem(contentItem());
 
             connect(mainItem, SIGNAL(widthChanged()), this, SLOT(slotMainItemSizeChanged()));

-- 
To view, visit https://gerrit.vesnicky.cesnet.cz/r/282
To unsubscribe, visit https://gerrit.vesnicky.cesnet.cz/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I92b969e60b4fdbe4ff2c70f9cce6e3408482a862
Gerrit-PatchSet: 1
Gerrit-Project: plasma-framework
Gerrit-Branch: master
Gerrit-Owner: David Edmundson <david at davidedmundson.co.uk>
Gerrit-Reviewer: Marco Martin <notmart at gmail.com>


More information about the Plasma-devel mailing list