rectangular DelayButton
Solved
QML and Qt Quick
-
ok thanks ... sorry but i have active import QtQuick.Extras 1.4 in my file ..... so only round DelayButton .... but if cancel these module all works ....
Other things not undestand how is possible to change color and backgroundcolor of delay button, for example yellow and red instead of grey and darkgray as standard style.
thanks
-
@gfxx I try with these demo code but with no success ...
DelayButton { id: delayPress width: 100 height: 50 display: AbstractButton.TextOnly delay: 3000 font.bold: true anchors.top: parent.top anchors.topMargin: 0 checkable: true anchors.horizontalCenter: parent.horizontalCenter opacity: delayPress.enabled? 1 : 0.3 visible: true text: "Delay\nButton" contentItem: Text { text: delayPress.text font: delayPress.font opacity: enabled ? 1.0 : 0.3 color: "white" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } background: Rectangle { implicitWidth: delayPress.width implicitHeight: delayPress.height opacity: enabled ? 1 : 0.3 color: delayPress.down ? "#17a81a" : "#21be2b" //border.color: "#2b6016" //border.width: 1 antialiasing: true radius: 2 anchors.centerIn: parent Canvas { id: canvas anchors.fill: parent Connections { target: delayPress onProgressChanged: canvas.requestPaint() } onPaint: { var ctx = getContext("2d") ctx.clearRect(0, 0, delayPress.width, delayPress.height) ctx.strokeStyle = "red" ctx.beginPath() var startPoint = 0 var endPoint = startPoint + delayPress.progress ctx.fillRect(startPoint, delayPress.height, endPoint, delayPress.height) ctx.stroke() } } }
some suggest?