From b6f5f235f0ab3c84e960f2cf46e542592195abbf Mon Sep 17 00:00:00 2001 From: Sebastian Kügler Date: Fri, 4 Dec 2015 00:27:35 +0100 Subject: sync with mobilecomponents 9d8bf6d77d MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixes interactivity in context drawer. - These are mostly cleanups that have been done pre-merge of these components. This now is the state of master in plasma-mobile. - makes navigation a bit more intuitive Signed-off-by: Sebastian Kügler --- .../qml/mobilecomponents/private/ActionButton.qml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'qt-mobile/qml/mobilecomponents/private') diff --git a/qt-mobile/qml/mobilecomponents/private/ActionButton.qml b/qt-mobile/qml/mobilecomponents/private/ActionButton.qml index 4dbea98b8..9ad55ff7c 100644 --- a/qt-mobile/qml/mobilecomponents/private/ActionButton.qml +++ b/qt-mobile/qml/mobilecomponents/private/ActionButton.qml @@ -25,6 +25,8 @@ import org.kde.plasma.mobilecomponents 0.2 MouseArea { id: button property alias iconSource: icon.source + property bool checkable: false + property bool checked: false Layout.minimumWidth: Units.iconSizes.large Layout.maximumWidth: Layout.minimumWidth implicitWidth: Units.iconSizes.large @@ -35,9 +37,9 @@ MouseArea { minimumX: contextDrawer ? 0 : parent.width/2 - width/2 maximumX: globalDrawer ? parent.width : parent.width/2 - width/2 } - function toggle() { + function toggleVisibility() { showAnimation.running = false; - if (transform[0].y < button.height) { + if (translateTransform.y < button.height) { showAnimation.to = button.height; } else { showAnimation.to = 0; @@ -45,7 +47,9 @@ MouseArea { showAnimation.running = true; } - transform: Translate {} + transform: Translate { + id: translateTransform + } onReleased: { if (globalDrawer && x > Math.min(parent.width/4*3, parent.width/2 + globalDrawer.contentItem.width/2)) { globalDrawer.open(); @@ -66,6 +70,11 @@ MouseArea { } } } + onClicked: { + if (checkable) { + checked = !checked; + } + } Connections { target: globalDrawer onPositionChanged: { @@ -99,7 +108,7 @@ MouseArea { NumberAnimation { id: showAnimation - target: button.transform[0] + target: translateTransform properties: "y" duration: Units.longDuration easing.type: Easing.InOutQuad @@ -116,7 +125,7 @@ MouseArea { anchors.centerIn: parent height: parent.height - Units.smallSpacing*2 width: height - color: button.pressed ? Theme.highlightColor : Theme.backgroundColor + color: button.pressed || button.checked ? Theme.highlightColor : Theme.backgroundColor Icon { id: icon anchors { -- cgit v1.2.3-70-g09d2