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

List:       kde-commits
Subject:    [declarative-plasmoids] tasks/package/contents/ui: introducing a context menu..
From:       Shaun Reich <shaun.reich () kdemail ! net>
Date:       2012-02-10 16:11:56
Message-ID: 20120210161156.8BBC9A60CD () git ! kde ! org
[Download RAW message or body]

Git commit 5af625b30c57882c4f2169abd1187ecaa1094f13 by Shaun Reich.
Committed on 10/02/2012 at 16:00.
Pushed by sreich into branch 'master'.

introducing a context menu..

it must be parented incorrectly or somethinb, because it can only be
opened once per item :D

M  +28   -2    tasks/package/contents/ui/main.qml

http://commits.kde.org/declarative-plasmoids/5af625b30c57882c4f2169abd1187ecaa1094f13

diff --git a/tasks/package/contents/ui/main.qml b/tasks/package/contents/ui/main.qml
index fdc2ab4..4c9062a 100644
--- a/tasks/package/contents/ui/main.qml
+++ b/tasks/package/contents/ui/main.qml
@@ -21,6 +21,7 @@ import org.kde.qtextracomponents 0.1
 
 import org.kde.plasma.core 0.1 as PlasmaCore
 import org.kde.plasma.components 0.1 as PlasmaComponents
+import org.kde.plasma.components 0.1
 
 Item {
     id: tasks
@@ -61,6 +62,28 @@ Item {
     }
 
     Component {
+        id: contextMenuComponent
+        PlasmaComponents.ContextMenu {
+            PlasmaComponents.MenuItem {
+                text: "White"
+//                onClicked: contentMenuButton.parent.color = "White"
+            }
+            PlasmaComponents.MenuItem {
+                text: "Red"
+ //               onClicked: contentMenuButton.parent.color = "Red"
+            }
+            PlasmaComponents.MenuItem {
+                text: "LightBlue"
+  //              onClicked: contentMenuButton.parent.color = "LightBlue"
+            }
+            PlasmaComponents.MenuItem {
+                text: "LightGreen"
+   //             onClicked: contentMenuButton.parent.color = "LightGreen"
+            }
+        }
+    }
+
+    Component {
         id: tasksDelegate
 
         Item {
@@ -108,13 +131,16 @@ Item {
             ]
 
             property bool hovered: false
-
+            property ContextMenu contextMenu
             MouseArea {
                 anchors.fill: parent
                 hoverEnabled: true
 
                 onClicked: {
-                    
+                    if (!contextMenu) {
+                        contextMenu = contextMenuComponent.createObject(parent)
+                        contextMenu.open()
+                    }
                 }
 
                 onEntered: {

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

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