summaryrefslogtreecommitdiffstats
path: root/qt-mobile/qml/mobilecomponents/private/ActionButton.qml
diff options
context:
space:
mode:
authorGravatar Sebastian Kügler <sebas@kde.org>2016-01-06 04:40:33 +0100
committerGravatar Sebastian Kügler <sebas@kde.org>2016-01-06 04:41:41 +0100
commit548d6fc956061cd1edb177447cdf07104d92b9c7 (patch)
treee8263e890f0a3294cc5b013fa4e5b61ab46ab037 /qt-mobile/qml/mobilecomponents/private/ActionButton.qml
parent8664925e20f4f4b700ace48765477a9ca3fb36dd (diff)
downloadsubsurface-548d6fc956061cd1edb177447cdf07104d92b9c7.tar.gz
sync with mobilecomponents a85365111 + patches
This is the latest state of the upstream art from Plasma, plus our patches to disable the gamma effect on the icon, and the drawer removed. Signed-off-by: Sebastian Kügler <sebas@kde.org>
Diffstat (limited to 'qt-mobile/qml/mobilecomponents/private/ActionButton.qml')
-rw-r--r--qt-mobile/qml/mobilecomponents/private/ActionButton.qml11
1 files changed, 9 insertions, 2 deletions
diff --git a/qt-mobile/qml/mobilecomponents/private/ActionButton.qml b/qt-mobile/qml/mobilecomponents/private/ActionButton.qml
index 9ad55ff7c..80f037e48 100644
--- a/qt-mobile/qml/mobilecomponents/private/ActionButton.qml
+++ b/qt-mobile/qml/mobilecomponents/private/ActionButton.qml
@@ -27,6 +27,8 @@ MouseArea {
property alias iconSource: icon.source
property bool checkable: false
property bool checked: false
+ //either Action or QAction should work here
+ property QtObject action
Layout.minimumWidth: Units.iconSizes.large
Layout.maximumWidth: Layout.minimumWidth
implicitWidth: Units.iconSizes.large
@@ -34,8 +36,8 @@ MouseArea {
drag {
target: button
axis: Drag.XAxis
- minimumX: contextDrawer ? 0 : parent.width/2 - width/2
- maximumX: globalDrawer ? parent.width : parent.width/2 - width/2
+ minimumX: parent.width/2 - width/2 - (contextDrawer && contextDrawer.enabled ? contextDrawer.contentItem.width : 0)
+ maximumX: parent.width/2 - width/2 + (globalDrawer && globalDrawer.enabled ? globalDrawer.contentItem.width : 0)
}
function toggleVisibility() {
showAnimation.running = false;
@@ -74,6 +76,11 @@ MouseArea {
if (checkable) {
checked = !checked;
}
+
+ //if an action has been assigned, trigger it
+ if (button.action && button.action.trigger) {
+ button.action.trigger();
+ }
}
Connections {
target: globalDrawer