fix:TextInput support hot update;feat:add zero color and update
algorithm
This commit is contained in:
@@ -63,6 +63,7 @@ Rectangle {
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 4
|
||||
spacing: 8
|
||||
|
||||
Label {
|
||||
@@ -167,6 +168,7 @@ Rectangle {
|
||||
text: root.formatHexByte(Backend.serial.deviceAddress)
|
||||
placeholderText: "0x01"
|
||||
inputMethodHints: Qt.ImhPreferUppercase
|
||||
property bool _internalUpdate: false
|
||||
validator: RegularExpressionValidator {
|
||||
regularExpression: /^(0x|0X)?[0-9a-fA-F]{1,2}$/
|
||||
}
|
||||
@@ -183,7 +185,9 @@ Rectangle {
|
||||
Connections {
|
||||
target: Backend.serial
|
||||
function onDeviceAddressChanged() {
|
||||
addrField._internalUpdate = true
|
||||
addrField.text = root.formatHexByte(Backend.serial.deviceAddress)
|
||||
addrField._internalUpdate = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -423,12 +427,31 @@ Rectangle {
|
||||
color: root.textColor
|
||||
}
|
||||
SpinBox {
|
||||
id: rangeMinBox
|
||||
Layout.fillWidth: true
|
||||
from: -999999
|
||||
to: 999999
|
||||
editable: true
|
||||
value: Backend.rangeMin
|
||||
function applyTextEdit() {
|
||||
if (!contentItem) return
|
||||
const parsed = valueFromText(contentItem.text, locale)
|
||||
if (isNaN(parsed)) return
|
||||
const clamped = Math.max(from, Math.min(to, parsed))
|
||||
if (Backend.rangeMin !== clamped) {
|
||||
Backend.rangeMin = clamped
|
||||
}
|
||||
}
|
||||
onValueModified: Backend.rangeMin = value
|
||||
Connections {
|
||||
target: rangeMinBox.contentItem
|
||||
function onTextEdited() { rangeMinBox.applyTextEdit() }
|
||||
function onEditingFinished() { rangeMinBox.applyTextEdit() }
|
||||
function onAccepted() {
|
||||
rangeMinBox.applyTextEdit()
|
||||
rangeMinBox.focus = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,12 +464,62 @@ Rectangle {
|
||||
color: root.textColor
|
||||
}
|
||||
SpinBox {
|
||||
id: rangeMaxBox
|
||||
Layout.fillWidth: true
|
||||
from: -999999
|
||||
to: 999999
|
||||
editable: true
|
||||
value: Backend.rangeMax
|
||||
function applyTextEdit() {
|
||||
if (!contentItem) return
|
||||
const parsed = valueFromText(contentItem.text, locale)
|
||||
if (isNaN(parsed)) return
|
||||
const clamped = Math.max(from, Math.min(to, parsed))
|
||||
if (Backend.rangeMax !== clamped) {
|
||||
Backend.rangeMax = clamped
|
||||
}
|
||||
}
|
||||
onValueModified: Backend.rangeMax = value
|
||||
Connections {
|
||||
target: rangeMaxBox.contentItem
|
||||
function onTextEdited() { rangeMaxBox.applyTextEdit() }
|
||||
function onEditingFinished() { rangeMaxBox.applyTextEdit() }
|
||||
function onAccepted() {
|
||||
rangeMaxBox.applyTextEdit()
|
||||
rangeMaxBox.focus = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 8
|
||||
Label {
|
||||
text: root.tr("零色")
|
||||
Layout.preferredWidth: 90
|
||||
color: root.textColor
|
||||
}
|
||||
Rectangle {
|
||||
width: 22
|
||||
height: 22
|
||||
radius: 4
|
||||
color: Backend.colorZero
|
||||
border.width: 1
|
||||
border.color: Qt.rgba(0, 0, 0, 0.2)
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
zeroColorDialog.openWith(Backend.colorZero)
|
||||
}
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: root.tr("选择")
|
||||
Layout.fillWidth: true
|
||||
onClicked: {
|
||||
zeroColorDialog.openWith(Backend.colorZero)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -557,6 +630,11 @@ Rectangle {
|
||||
checked: Backend.showGrid
|
||||
onToggled: Backend.showGrid = checked
|
||||
}
|
||||
CheckBox {
|
||||
text: root.tr("凹陷表面")
|
||||
checked: Backend.useHeatmap
|
||||
onToggled: Backend.useHeatmap = checked
|
||||
}
|
||||
CheckBox {
|
||||
text: root.tr("显示坐标轴")
|
||||
checked: false
|
||||
@@ -589,6 +667,13 @@ Rectangle {
|
||||
Item { Layout.fillHeight: true }
|
||||
}
|
||||
}
|
||||
|
||||
ColorPickerDialog {
|
||||
id: zeroColorDialog
|
||||
title: root.tr("选择零色")
|
||||
onAccepted: Backend.colorZero = c
|
||||
}
|
||||
|
||||
|
||||
ColorPickerDialog {
|
||||
id: lowColorDialog
|
||||
|
||||
Reference in New Issue
Block a user