From 508f316bc5436aaec5faee0a458284dfbc686a17 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Mon, 22 May 2023 03:41:20 +0200 Subject: [PATCH] Better pick location settings overlay --- .../LogarithmPlotter/PickLocationOverlay.qml | 113 ++++++++++++++---- .../ad5001/LogarithmPlotter/Setting/Icon.qml | 2 +- 2 files changed, 91 insertions(+), 24 deletions(-) diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml index d0fb559..5173a24 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml @@ -18,6 +18,7 @@ import QtQuick import QtQuick.Controls +import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting import "js/objects.js" as Objects import "js/mathlib.js" as MathLib import "js/historylib.js" as HistoryLib @@ -36,6 +37,7 @@ import "js/historylib.js" as HistoryLib Item { id: pickerRoot visible: false + clip: true /*! \qmlproperty var PickLocationOverlay::canvas @@ -120,31 +122,96 @@ Item { } } - Row { - height: precisionSlider.height - Text { - text: " "+ qsTr("Pointer precision:") + " " - color: 'black' - anchors.verticalCenter: parent.verticalCenter - } + + + Rectangle { + id: pickerSettings + radius: 15 + color: sysPalette.window + width: pickerSettingsColumn.width + 30; + height: pickerSettingsColumn.height + 20 + property bool folded: false; + x: -15 - ((width-55) * folded); + y: 10 + z: 2 - Slider { - id: precisionSlider - from: 0 - value: 2 - to: 10 - stepSize: 1 - ToolTip { - parent: precisionSlider.handle - visible: precisionSlider.pressed - text: precisionSlider.value.toFixed(0) + Row { + id: pickerSettingsColumn + anchors { + left: parent.left + top: parent.top + leftMargin: 20 + topMargin: 10 + } + spacing: 15 + property int cellHeight: 15 + + Column { + spacing: 5 + width: 100 + + Text { + text: qsTr("Pointer precision:") + color: sysPalette.windowText + verticalAlignment: Text.AlignVCenter + height: pickerSettingsColumn.cellHeight + } + + Text { + text: qsTr("Snap to grid") + ":" + color: sysPalette.windowText + verticalAlignment: Text.AlignVCenter + height: pickerSettingsColumn.cellHeight + } + } + + Column { + spacing: 5 + + Slider { + id: precisionSlider + from: 0 + value: 2 + to: 10 + stepSize: 1 + height: pickerSettingsColumn.cellHeight + + ToolTip { + parent: precisionSlider.handle + visible: precisionSlider.pressed + text: precisionSlider.value.toFixed(0) + } + } + + CheckBox { + id: snapToGridCheckbox + height: pickerSettingsColumn.cellHeight + // text: qsTr("Snap to grid") + checked: false + } + } + + Button { + width: 24 + anchors.top: parent.top + anchors.bottom: parent.bottom + flat: true + + onClicked: pickerSettings.folded = !pickerSettings.folded + + ToolTip.visible: hovered + ToolTip.delay: 200 + ToolTip.text: pickerSettings.folded ? qsTr("Open picker settings") : qsTr("Hide picker settings") + + Setting.Icon { + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + width: 18 + height: 18 + color: sysPalette.windowText + source: `../icons/common/settings.svg` + } } - } - - CheckBox { - id: snapToGridCheckbox - text: qsTr("Snap to grid") - checked: false } } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/Icon.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/Icon.qml index 5cc6204..7fa45e7 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/Icon.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/Icon.qml @@ -47,11 +47,11 @@ Item { id: img height: parent.height width: parent.width - //smooth: true visible: false sourceSize.width: width*Screen.devicePixelRatio sourceSize.height: width*Screen.devicePixelRatio } + ColorOverlay { anchors.fill: img source: img