harbour-seaprint/qml/components/IntegerInputDialog.qml

38 lines
755 B
QML
Raw Normal View History

2021-07-11 15:27:03 +03:00
import QtQuick 2.6
2019-12-01 22:27:00 +03:00
import Sailfish.Silica 1.0
Dialog {
id: dialog
2020-08-06 18:34:14 +03:00
allowedOrientations: Orientation.All
2019-12-01 22:27:00 +03:00
property int value
property int min;
property int max;
property string title
canAccept: valueField.acceptableInput
Column {
width: parent.width
DialogHeader { }
TextField {
id: valueField
validator: IntValidator{bottom: min; top: max;}
width: parent.width
2023-02-25 18:15:45 +03:00
placeholderText: ""+min+"-"+(max == 65535 ? "..." : max)
2019-12-01 22:27:00 +03:00
label: title
focus: true
inputMethodHints: Qt.ImhDigitsOnly
}
}
onDone: {
if (result == DialogResult.Accepted) {
value = valueField.text
}
}
}