本文主要是介绍Qt/QML学习-SpinBox,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
QML学习
- SpinBox例程
- 视频讲解
- 代码
main.qml
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15Window {width: 640height: 480visible: truetitle: qsTr("SpinBox")SpinBox {id: spinBoxanchors.centerIn: parentfrom: 0to: 100value: 50stepSize: 20editable: truebackground: Rectangle {implicitWidth: 200implicitHeight: 100border.width: 1}contentItem: Rectangle {TextInput {anchors.centerIn: parenttext: spinBox.valuefont.pointSize: 30readOnly: !spinBox.editable}}down {indicator: Rectangle {implicitWidth: spinBox.background.width / 4implicitHeight: spinBox.background.heightborder.width: 1color: enabled?spinBox.down.pressed? "gray": "white":"lightGray"Text {anchors.centerIn: parentfont.pointSize: 30text: "-"}}}up {indicator: Rectangle {implicitWidth: spinBox.background.width / 4implicitHeight: spinBox.background.heightx: spinBox.background.width - widthborder.width: 1color: enabled?spinBox.up.pressed? "gray": "white":"lightGray"Text {anchors.centerIn: parentfont.pointSize: 30text: "+"}}}}
}
演示
视频讲解
这篇关于Qt/QML学习-SpinBox的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!