Better pick location settings overlay

This commit is contained in:
Ad5001 2023-05-22 03:41:20 +02:00
parent 424eef6e17
commit 508f316bc5
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
2 changed files with 91 additions and 24 deletions

View file

@ -18,6 +18,7 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import "js/objects.js" as Objects import "js/objects.js" as Objects
import "js/mathlib.js" as MathLib import "js/mathlib.js" as MathLib
import "js/historylib.js" as HistoryLib import "js/historylib.js" as HistoryLib
@ -36,6 +37,7 @@ import "js/historylib.js" as HistoryLib
Item { Item {
id: pickerRoot id: pickerRoot
visible: false visible: false
clip: true
/*! /*!
\qmlproperty var PickLocationOverlay::canvas \qmlproperty var PickLocationOverlay::canvas
@ -120,13 +122,51 @@ Item {
} }
} }
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
Row { Row {
height: precisionSlider.height id: pickerSettingsColumn
Text { anchors {
text: " "+ qsTr("Pointer precision:") + " " left: parent.left
color: 'black' top: parent.top
anchors.verticalCenter: parent.verticalCenter 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 { Slider {
id: precisionSlider id: precisionSlider
@ -134,6 +174,8 @@ Item {
value: 2 value: 2
to: 10 to: 10
stepSize: 1 stepSize: 1
height: pickerSettingsColumn.cellHeight
ToolTip { ToolTip {
parent: precisionSlider.handle parent: precisionSlider.handle
visible: precisionSlider.pressed visible: precisionSlider.pressed
@ -143,11 +185,36 @@ Item {
CheckBox { CheckBox {
id: snapToGridCheckbox id: snapToGridCheckbox
text: qsTr("Snap to grid") height: pickerSettingsColumn.cellHeight
// text: qsTr("Snap to grid")
checked: false 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`
}
}
}
}
Rectangle { Rectangle {
id: xCursor id: xCursor
width: 1 width: 1

View file

@ -47,11 +47,11 @@ Item {
id: img id: img
height: parent.height height: parent.height
width: parent.width width: parent.width
//smooth: true
visible: false visible: false
sourceSize.width: width*Screen.devicePixelRatio sourceSize.width: width*Screen.devicePixelRatio
sourceSize.height: width*Screen.devicePixelRatio sourceSize.height: width*Screen.devicePixelRatio
} }
ColorOverlay { ColorOverlay {
anchors.fill: img anchors.fill: img
source: img source: img