ARTICLE DETAIL

资讯详情

深耕网站建设、视觉设计与SEO优化的一线实战洞察。

QML之加速器仪表盘

QML之加速器仪表盘

1.QML 代码如下

import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Extras 1.4
import QtQuick.Controls 2.15Window {width: 640height: 480visible: truetitle: qsTr("Hello World")CircularGauge {id:circular_gaugevalue: accelerating ? maximumValue : 0anchors.centerIn: parentproperty bool accelerating: falseKeys.onSpacePressed: {accelerating = truelabel1.text = circular_gauge.value}Keys.onReleased: {if (event.key === Qt.Key_Space) {accelerating = false;event.accepted = true;}}Component.onCompleted: forceActiveFocus()Behavior on value {NumberAnimation {duration: 1000}}}Label{id:label1anchors.top: circular_gauge.bottom}
}

2.执行结果

返回列表