diff options
author | Samuel Ghinet <samuel.ghinet@qt.io> | 2021-11-12 16:54:00 +0200 |
---|---|---|
committer | Samuel Ghinet <samuel.ghinet@qt.io> | 2021-11-12 15:24:41 +0000 |
commit | ebc753cf9bcf58918efe5282449966af3a37d132 (patch) | |
tree | 8cad7eefa9665bd818be48c8937e40fecd8a60ee /share | |
parent | 76d3ffa57a525b53ccfa16c7204a7848ce36a13a (diff) |
Replace TextField with RealSpinBox for custom width and height
Change-Id: I07f993033a4a0fa5168abd0636fc883bd3ccd7fe
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'share')
-rw-r--r-- | share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/Details.qml | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/Details.qml b/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/Details.qml index c7ed3ec8d6..87a63dcefe 100644 --- a/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/Details.qml +++ b/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/Details.qml @@ -202,8 +202,8 @@ Item { dialogBox.setScreenSizeIndex(index); var r = screenSizeModel.screenSizes(index); - widthTextField.text = r.width; - heightTextField.text = r.height; + widthField.realValue = r.width; + heightField.realValue = r.height; } Connections { @@ -252,19 +252,20 @@ Item { } // content items - SC.TextField { - id: widthTextField + SC.RealSpinBox { + id: widthField actionIndicatorVisible: false - translationIndicatorVisible: false - implicitWidth: 50 - color: DialogValues.textColor - selectByMouse: true - validator: IntValidator { bottom: 1; top: 100000; } + implicitWidth: 70 + labelColor: DialogValues.textColor + realFrom: 100 + realTo: 100000 + realValue: 100 + realStepSize: 10 font.pixelSize: DialogValues.defaultPixelSize - onTextChanged: { - var height = heightTextField.text ? parseInt(heightTextField.text) : 0 - var width = text ? parseInt(text) : 0 + onRealValueChanged: { + var height = heightField.realValue + var width = realValue if (width >= height) orientationButton.setHorizontal() @@ -276,22 +277,23 @@ Item { Binding { target: dialogBox property: "customWidth" - value: widthTextField.text + value: widthField.realValue } - SC.TextField { - id: heightTextField + SC.RealSpinBox { + id: heightField actionIndicatorVisible: false - translationIndicatorVisible: false - implicitWidth: 50 - color: DialogValues.textColor - selectByMouse: true - validator: IntValidator { bottom: 1; top: 100000; } + implicitWidth: 70 + labelColor: DialogValues.textColor + realFrom: 100 + realTo: 100000 + realValue: 100 + realStepSize: 10 font.pixelSize: DialogValues.defaultPixelSize - onTextChanged: { - var height = text ? parseInt(text) : 0 - var width = widthTextField.text ? parseInt(widthTextField.text) : 0 + onRealValueChanged: { + var height = realValue + var width = widthField.realValue if (width >= height) orientationButton.setHorizontal() @@ -303,7 +305,7 @@ Item { Binding { target: dialogBox property: "customHeight" - value: heightTextField.text + value: heightField.realValue } Item { Layout.fillWidth: true } @@ -348,9 +350,8 @@ Item { } onClicked: { - if (widthTextField.text && heightTextField.text) { - [widthTextField.text, heightTextField.text] = [heightTextField.text, widthTextField.text]; - + if (widthField.realValue && heightField.realValue) { + [widthField.realValue, heightField.realValue] = [heightField.realValue, widthField.realValue]; checked = !checked } } |