Add help button and fix linenumbers with
This commit is contained in:
parent
1ea57cedee
commit
f60d20245e
@ -63,6 +63,14 @@ Page {
|
||||
placeholderText: qsTr("Script name")
|
||||
}
|
||||
|
||||
HeaderButton {
|
||||
imageSource: "../images/question.svg"
|
||||
text: qsTr("Help")
|
||||
onClicked: {
|
||||
Qt.openUrlExternally("https://nymea.io/en/wiki/nymea/master/configuration/scripting")
|
||||
}
|
||||
}
|
||||
|
||||
HeaderButton {
|
||||
imageSource: "../images/save.svg"
|
||||
enabled: d.script && d.script.name !== nameTextField.text || d.oldContent !== scriptEdit.text
|
||||
|
||||
@ -10,22 +10,27 @@ Rectangle {
|
||||
id: fontMetrics
|
||||
font: textArea.font
|
||||
}
|
||||
|
||||
width: {
|
||||
var ret = fontMetrics.maximumCharacterWidth * 2;
|
||||
var tmp = textArea.lineCount
|
||||
while (tmp >= 10) {
|
||||
ret += fontMetrics.maximumCharacterWidth;
|
||||
tmp /= 10;
|
||||
TextMetrics {
|
||||
id: textMetrics
|
||||
font: textArea.font
|
||||
text: {
|
||||
var digits = 1;
|
||||
var tmp = textArea.lineCount;
|
||||
while (tmp >= 10) {
|
||||
digits++;
|
||||
tmp /= 10;
|
||||
}
|
||||
var str = ""
|
||||
for (var i = 0; i < digits; i++) {
|
||||
str += "0"
|
||||
}
|
||||
return str;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
width: textMetrics.advanceWidth + app.margins / 2
|
||||
height: root.textArea.height - 10
|
||||
color: (app.backgroundColor.r * 0.2126 + app.backgroundColor.g * 0.7152 + app.backgroundColor.b * 0.0722) * 255 < 128 ? "#202020" : "#e0e0e0"
|
||||
Component.onCompleted: {
|
||||
print("..", app.backgroundColor.r)
|
||||
print("*** background", (app.backgroundColor.r * 0.2126 + app.backgroundColor.g * 0.7152 + app.backgroundColor.b * 0.0722) * 255 < 128 )
|
||||
}
|
||||
|
||||
Column {
|
||||
id: lineNumbersColumn
|
||||
|
||||
Reference in New Issue
Block a user