[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    [kde-workspace/frameworks-scratch] plasma/desktop/containments/desktop/package/contents/ui: crashes-
From:       Sebastian_Kügler <sebas () kde ! org>
Date:       2013-09-21 2:55:58
Message-ID: E1VNDMU-0002e4-AY () scm ! kde ! org
[Download RAW message or body]

Git commit 3f050cea05e2a6a6f746998f26c76222a99d055f by Sebastian Kügler.
Committed on 21/09/2013 at 02:40.
Pushed by sebas into branch 'frameworks-scratch'.

crashes--: Rework applet handle anchoring

Use a property to track the parent item. This makes it easier to do the
re-anchoring of the applet handle on size changes. One effect is that
property bindings are apparently triggered in a more deterministic way.
A nice side effect is that this simplifies the code a bit.
Lesson: be *very* careful when swapping out individual properties in
javascript code, rather rely more on property bindings to do the work
for you.

IOW: This fixes a nasty crasher in the applet handle.

CCMAIL:plasma-devel@kde.org

M  +2    -1    plasma/desktop/containments/desktop/package/contents/ui/AppletAppearance.qml
 M  +15   -22   plasma/desktop/containments/desktop/package/contents/ui/AppletHandle.qml


http://commits.kde.org/kde-workspace/3f050cea05e2a6a6f746998f26c76222a99d055f

diff --git a/plasma/desktop/containments/desktop/package/contents/ui/AppletAppearance.qml \
b/plasma/desktop/containments/desktop/package/contents/ui/AppletAppearance.qml index \
                7d10595..257adff 100644
--- a/plasma/desktop/containments/desktop/package/contents/ui/AppletAppearance.qml
+++ b/plasma/desktop/containments/desktop/package/contents/ui/AppletAppearance.qml
@@ -63,7 +63,8 @@ Item {
     visible: false
 
     onHeightChanged: {
-        if (appletHandle.source != "") {
+        if (appletHandle.source != "" && appletHandle.visible) {
+            print("updateHeight");
             appletHandle.item.updateHeight();
         }
         //print("handleMerged : " + appletItem.handleMerged + " min, height " + mini \
                + ", " + appletHandle.height);
diff --git a/plasma/desktop/containments/desktop/package/contents/ui/AppletHandle.qml \
b/plasma/desktop/containments/desktop/package/contents/ui/AppletHandle.qml index \
                3817083..7274079 100644
--- a/plasma/desktop/containments/desktop/package/contents/ui/AppletHandle.qml
+++ b/plasma/desktop/containments/desktop/package/contents/ui/AppletHandle.qml
@@ -26,63 +26,56 @@ import "plasmapackage:/code/LayoutManager.js" as LayoutManager
 Item {
     id: appletHandle
 
-    //z: dragMouseArea.z + 1
     opacity: appletItem.controlsOpacity
     width: appletItem.handleWidth
     height: appletItem.handleHeight
+    //z: dragMouseArea.z + 1
 
     property int buttonMargin: 6
     property int minimumHeight:  6 * (root.iconSize + buttonMargin)
+    property Item buttonsParent: appletHandle
 
     signal removeApplet
 
     function updateHeight() {
-        // Does the handle's height fit into the frame?
         var mini = appletHandle.minimumHeight + margins.top + margins.bottom;
-        //print(" = == = = == updateHeight mini:" + mini)
         if (height > mini) {
             appletItem.handleMerged = true;
-//             print("merged handle");
             height = appletItem.handleMerged ? appletItem.height : minimumHeight
-            //print(" height: " + height);
-            buttonColumn.anchors.right = appletHandle.right;
-        } else {
+            buttonsParent = appletHandle;
+        } else if (appletItem.handleMerged) {
             appletItem.handleMerged = false;
-//             print("separate handle");
-            //appletHandle.anchors.right = appletHandle.parent.right;
-            buttonColumn.anchors.verticalCenter = appletItem.verticalCenter;
-            buttonColumn.anchors.top = noBackgroundHandle.top
-            buttonColumn.anchors.bottom = noBackgroundHandle.bottom
-            buttonColumn.anchors.right = noBackgroundHandle.right
+            buttonsParent = noBackgroundHandle;
         }
     }
     PlasmaCore.FrameSvgItem {
         id: noBackgroundHandle
 
         width: handleWidth + margins.left + margins.right - 4
-        height: handleMerged ? appletItem.handleHeight + \
noBackgroundHandle.margins.top + noBackgroundHandle.margins.bottom : \
                appletItem.handleHeight
-        visible: opacity > 0
+        height: (backgroundHints != "NoBackground") ? appletItem.handleHeight : \
appletItem.handleHeight + noBackgroundHandle.margins.top + \
noBackgroundHandle.margins.bottom +        visible: controlsOpacity > 0
         z: plasmoidBackground.z - 10
 
         anchors {
-            verticalCenter: parent.verticalCenter
-            left: parent.right
+            verticalCenter: buttonsParent.verticalCenter
+            left: buttonsParent.right
             leftMargin: handleMerged ? ((1-controlsOpacity) * \
appletItem.handleWidth) * -1 - appletItem.handleWidth * 2 + 2 : ((1-controlsOpacity) \
* appletItem.handleWidth) * -1 - appletItem.handleWidth  }
-        opacity: (backgroundHints == "NoBackground" || !handleMerged) ? \
controlsOpacity : 0  smooth: true
         imagePath: (backgroundHints == "NoBackground" || !handleMerged) ? \
                "widgets/background" : ""
-        Rectangle { color: Qt.rgba(0,0,0,0); border.width: 3; border.color: \
"orange"; opacity: 1; visible: debug; anchors.fill: parent; } +        //Rectangle { \
color: Qt.rgba(0,0,0,0); border.width: 3; border.color: "orange"; opacity: 1; \
visible: debug; anchors.fill: parent; }  }
 
     Column {
         id: buttonColumn
         width: handleWidth
+        parent: buttonsParent
         anchors {
             top: parent.top
-            topMargin: (!appletItem.hasBackground) ? noBackgroundHandle.margins.top \
                : appletItem.margins.top
-            bottomMargin: appletItem.margins.bottom
-            right: appletItem.handleMerged ? parent.right : noBackgroundHandle.right
+            topMargin: (!appletItem.hasBackground || !handleMerged) ? \
noBackgroundHandle.margins.top : appletItem.margins.top +            bottom: \
parent.bottom +            bottomMargin: (!appletItem.hasBackground && !handleMerged) \
? noBackgroundHandle.margins.bottom : appletItem.margins.bottom +            right: \
                parent.right
             rightMargin: appletItem.handleMerged ? -buttonMargin : \
noBackgroundHandle.margins.right - buttonMargin  }
         spacing: buttonMargin*2

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic