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 1 commit
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
31 changes: 25 additions & 6 deletions include/gz/gui/qml/GzSpinBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,31 @@ import QtQuick 2.9
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
Copy link
Contributor

@azeey azeey Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this, we should use the newer version of QtQuick Controls and remove the next line.

Suggested change
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls 2.15

Edit: I removed import QtQuick.Controls.Styles since that won't be needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


SpinBox {
style: SpinBoxStyle{
background: Rectangle {
implicitWidth: 70
implicitHeight: 40
border.color: "gray"
Item {
property double minimumValue : 0
property double maximumValue : 100
property double stepSize : 0
property double decimals : 0
property real value : 0
signal onEditingFinished()

TextField {
id: numberField
placeholderText: "0.0"
validator: DoubleValidator{bottom: minimumValue;
top: maximumValue;
decimals: decimals;
notation: DoubleValidator.StandardNotation;
}
onEditingFinished: {
parent.value = parseFloat(text)
}
style: TextFieldStyle{
background: Rectangle {
implicitWidth: 70
implicitHeight: 40
border.color: "gray"
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TextField from 2.15, doesn't have style. We'd just use background instead:

Suggested change
style: TextFieldStyle{
background: Rectangle {
implicitWidth: 70
implicitHeight: 40
border.color: "gray"
}
}
background: Rectangle {
implicitWidth: 70
implicitHeight: 40
border.color: "gray"
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}
}
Loading