summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Gilg <[email protected]>2017-03-02 22:16:34 +0100
committerRoman Gilg <[email protected]>2017-03-02 22:16:34 +0100
commitd8b305292240277309fc4dadd84ff2a3cbf6a154 (patch)
treec43bcd903bf8cb66eab2fd12c4cd787b9ebb2215
parent1966f954cf0a3776482a577bee5bf780056072ec (diff)
[Applet] Open contextMenu relatively to visual parent contextMenuButton
This will open the context menu aligned to its button and will not hide the button if there is not enough space for it. Reviewers: #plasma, drosca Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D4904
-rw-r--r--applet/contents/ui/ListItemBase.qml9
1 files changed, 6 insertions, 3 deletions
diff --git a/applet/contents/ui/ListItemBase.qml b/applet/contents/ui/ListItemBase.qml
index 3bc86d1..39ddeaa 100644
--- a/applet/contents/ui/ListItemBase.qml
+++ b/applet/contents/ui/ListItemBase.qml
@@ -112,7 +112,7 @@ PlasmaComponents.ListItem {
Layout.preferredWidth: Layout.preferredHeight
checkable: true
iconName: "application-menu"
- onClicked: contextMenu.show(x, y + height)
+ onClicked: contextMenu.show()
}
}
@@ -235,6 +235,9 @@ PlasmaComponents.ListItem {
PlasmaComponents.ContextMenu {
id: contextMenu
+ visualParent: contextMenuButton
+ placement: PlasmaCore.Types.BottomPosedLeftAlignedPopup
+
onStatusChanged: {
if (status == PlasmaComponents.DialogStatus.Closed) {
contextMenuButton.checked = false;
@@ -301,9 +304,9 @@ PlasmaComponents.ListItem {
}
}
- function show(x, y) {
+ function show() {
loadDynamicActions();
- open(x, y);
+ openRelative();
}
}
}