Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes SpinBox for a TextField #572

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions include/gz/gui/qml/GzSpinBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,32 @@
*
*/
import QtQuick 2.9
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls 2.15

SpinBox {
style: SpinBoxStyle{
Control {
id: spinBoxItem
property real minimumValue : 0
property real maximumValue : 100
property real stepSize : 0
property int decimals : 0
property real value : 0
signal editingFinished

TextField {
id: numberField
placeholderText: spinBoxItem.value
horizontalAlignment: TextInput.AlignHCenter
activeFocusOnPress: spinBoxItem.activeFocusOnPress
enabled: false // The TextField is disabled for the moment due to a not desired behavior.
validator: DoubleValidator{bottom: spinBoxItem.minimumValue;
top: spinBoxItem.maximumValue;
decimals: spinBoxItem.decimals;
notation: DoubleValidator.StandardNotation;
}
onEditingFinished: {
spinBoxItem.value = parseFloat(text)
spinBoxItem.editingFinished()
}
background: Rectangle {
implicitWidth: 70
implicitHeight: 40
Expand Down