diff options
Diffstat (limited to 'qt-mobile/qml/mobilecomponents/private/ActionButton.qml')
-rw-r--r-- | qt-mobile/qml/mobilecomponents/private/ActionButton.qml | 11 |
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 |