From 9e0db8f4ffa7d979ffb07cd9d76aee885c261196 Mon Sep 17 00:00:00 2001 From: Jaquee Date: Mon, 7 Aug 2017 15:47:56 +0200 Subject: components mobile scaling --- components/MenuButton.qml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'components/MenuButton.qml') diff --git a/components/MenuButton.qml b/components/MenuButton.qml index a7baa019..0e33057c 100644 --- a/components/MenuButton.qml +++ b/components/MenuButton.qml @@ -42,7 +42,7 @@ Rectangle { var offset = 0 var item = button while (item.under) { - offset += 20 + offset += 20 * scaleRatio item = item.under } return offset @@ -50,7 +50,7 @@ Rectangle { color: checked ? "#FFFFFF" : "#1C1C1C" property bool present: !under || under.checked || checked || under.numSelectedChildren > 0 - height: present ? ((appWindow.height >= 800) ? 64 : 52) : 0 + height: present ? ((appWindow.height >= 800) ? 64 * scaleRatio : 52 * scaleRatio ) : 0 transform: Scale { yScale: button.present ? 1 : 0 @@ -76,18 +76,18 @@ Rectangle { anchors.bottom: parent.bottom anchors.left: parent.left anchors.leftMargin: parent.getOffset() - width: 50 + width: 50 * scaleRatio Rectangle { id: dot anchors.centerIn: parent - width: 16 + width: 16 * scaleRatio height: width radius: height / 2 Rectangle { anchors.centerIn: parent - width: 12 + width: 12 * scaleRatio height: width radius: height / 2 color: "#1C1C1C" @@ -98,7 +98,7 @@ Rectangle { Text { id: symbolText anchors.centerIn: parent - font.pixelSize: 11 + font.pixelSize: 11 * scaleRatio font.bold: true color: button.checked || buttonArea.containsMouse ? "#FFFFFF" : dot.color visible: appWindow.ctrlPressed @@ -117,7 +117,7 @@ Rectangle { Image { anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right - anchors.rightMargin: 20 + anchors.rightMargin: 20 * scaleRatio anchors.leftMargin: parent.getOffset() source: "../images/menuIndicator.png" } @@ -126,9 +126,9 @@ Rectangle { id: label anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left - anchors.leftMargin: parent.getOffset() + 50 + anchors.leftMargin: parent.getOffset() + 50 * scaleRatio font.family: "Arial" - font.pixelSize: 18 + font.pixelSize: 18 * scaleRatio color: parent.checked ? "#000000" : "#FFFFFF" } -- cgit v1.2.3 From f605793cfcd15298579b08580fb37458a2c0e001 Mon Sep 17 00:00:00 2001 From: Jaquee Date: Tue, 8 Aug 2017 10:37:52 +0200 Subject: components android focus workaround --- components/MenuButton.qml | 9 ++++++++- components/StandardButton.qml | 12 +++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'components/MenuButton.qml') diff --git a/components/MenuButton.qml b/components/MenuButton.qml index 0e33057c..23ab4f74 100644 --- a/components/MenuButton.qml +++ b/components/MenuButton.qml @@ -38,6 +38,13 @@ Rectangle { property var under: null signal clicked() + function doClick() { + // Android workaround + releaseFocus(); + clicked(); + } + + function getOffset() { var offset = 0 var item = button @@ -139,7 +146,7 @@ Rectangle { onClicked: { if(parent.checked) return - button.clicked() + button.doClick() parent.checked = true } } diff --git a/components/StandardButton.qml b/components/StandardButton.qml index c55ebb12..3954c58c 100644 --- a/components/StandardButton.qml +++ b/components/StandardButton.qml @@ -45,6 +45,12 @@ Item { // Dynamic label width Layout.minimumWidth: (label.contentWidth + 10 * scaleRatio) // (label.contentWidth > 80)? label.contentWidth + 20 : 100 + function doClick() { + // Android workaround + releaseFocus(); + clicked(); + } + Rectangle { anchors.left: parent.left anchors.right: parent.right @@ -98,9 +104,9 @@ Item { MouseArea { id: buttonArea anchors.fill: parent - onClicked: parent.clicked() + onClicked: doClick() } - Keys.onSpacePressed: clicked() - Keys.onReturnPressed: clicked() + Keys.onSpacePressed: doClick() + Keys.onReturnPressed: doClick() } -- cgit v1.2.3