2023-05-26 20:53:26 +08:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: root
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 16
|
|
|
|
signal finished()
|
|
|
|
signal accepted(string result)
|
|
|
|
|
|
|
|
property string head
|
|
|
|
property string hint
|
|
|
|
|
|
|
|
Text {
|
|
|
|
text: qsTr(head)
|
|
|
|
font.pixelSize: 20
|
|
|
|
font.bold: true
|
|
|
|
Layout.fillWidth: true
|
2023-06-10 02:18:51 +08:00
|
|
|
wrapMode: Text.WordWrap
|
2023-05-26 20:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
text: qsTr(hint)
|
|
|
|
Layout.fillWidth: true
|
2023-06-10 02:18:51 +08:00
|
|
|
wrapMode: Text.WordWrap
|
2023-05-26 20:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
text: qsTr("validator_hint")
|
|
|
|
Layout.fillWidth: true
|
2023-06-10 02:18:51 +08:00
|
|
|
wrapMode: Text.WordWrap
|
2023-05-26 20:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
TextField {
|
|
|
|
id: edit
|
|
|
|
font.pixelSize: 18
|
|
|
|
Layout.fillWidth: true
|
2024-01-25 03:23:29 +08:00
|
|
|
validator: RegularExpressionValidator {
|
|
|
|
regularExpression: /[0-9A-Za-z_]+/
|
|
|
|
}
|
2023-05-26 20:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
text: "OK"
|
|
|
|
enabled: edit.text.length >= 4
|
|
|
|
onClicked: {
|
|
|
|
accepted(edit.text);
|
|
|
|
finished();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|