import QtQuick import QtQuick.Controls import QtQuick.Dialogs // import QtQuick.Controls.Styles import "./common" // import "./Style" Item { id: self width: 600 height: 50 property var locked: true property var remainingTime: 0 property alias _slider: slider signal lockClick signal unLockClick signal sendPlanCmd signal destime signal stopClick Row { id: row anchors.centerIn: parent spacing: 20 QxTitleButton { width: 40 height: 40 enabled: comIsOpen text: locked ? "解锁" : "锁定\n"+formatTime(remainingTime) anchors.top: parent.top anchors.topMargin: -5 onClicked: locked ? unLockClick() : lockClick() } Slider { id: slider width: self.width - 120 height: 50 enabled: comIsOpen stepSize: 1 value: 0 onPressedChanged: { if(!pressed) { sendPlanCmd() } } MouseArea { anchors.fill: parent propagateComposedEvents: false onPressed: { mouse.accepted = locked } onWheel: { /* 限制滚轮 if (wheel.angleDelta.y > 0) { slider.value += slider.stepSize } else { slider.value -= slider.stepSize }*/ } } Rectangle{ anchors.fill: parent color: "black" opacity: 0.5 radius: 5 visible: locked } Image{ anchors.centerIn: parent visible: locked source: "./resource/lock.png" } QxText { anchors.left: parent.left anchors.top: parent.top color: "#2a91be" text: "反向" z: -1 anchors.leftMargin: 20 font.pointSize: 10 anchors.topMargin: -1 } Row { anchors.bottom: parent.top anchors.horizontalCenter: parent.horizontalCenter width: 50 height: 20 QxText { text: "转速:" font.pointSize: 11 } QxText { font.pointSize: 11 text: Math.abs(slider.value) < 10 ? 0 : Math.abs(slider.value) } } QxText { anchors.right: parent.right anchors.top: parent.top color: "#dd2c42" text: "正向" z: -1 anchors.rightMargin: 20 anchors.topMargin: -1 font.pointSize: 10 } } QxTitleButton { width: 40 height: 40 text: "停止" enabled: comIsOpen anchors.top: parent.top anchors.topMargin: -5 onClicked: stopClick() } } Timer { interval: 1000; running: !locked; repeat: true onTriggered: destime() } }