Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.0
- import QtGraphicalEffects 1.12
- import QtMultimedia 5.12
- import net.standby 1.0
- Item {
- id: container
- height: 44
- width: 44
- property int radius: 5
- property int borderWidth: 2
- property color borderColor: "white"
- visible: available
- property alias iconColor: backgroundRectangle.color
- property alias iconSource: iconImage.source
- property alias text: textField.text
- property alias textColor: textField.color
- property ButtonModel buttonModel
- property bool active: buttonModel.active
- property bool standby: buttonModel.standby
- property bool available: buttonModel.available
- property bool delay: buttonModel.delay
- property bool error: buttonModel.error
- property bool disabled: buttonModel.disabled
- DropShadow {
- id: shadow
- anchors.fill: backgroundRectangle
- horizontalOffset: 0
- verticalOffset: 0
- radius: 12.0
- samples: 20
- color: "#000000"
- source: backgroundRectangle
- spread: 0
- }
- SequentialAnimation {
- id: animation
- running: delay
- loops: Animation.Infinite
- PropertyAnimation { target: backgroundRectangle; property: "border.color"; to: "#ff0000" ; duration: 1 }
- PauseAnimation { duration: 499 }
- PropertyAnimation { target: backgroundRectangle; property: "border.color"; to: container.borderColor ; duration: 1 }
- PauseAnimation { duration: 499 }
- }
- Rectangle {
- id: backgroundRectangle
- anchors.fill: parent
- color: "white"
- radius: container.radius
- border.width: container.borderWidth
- border.color: !delay ? (active ? "#ff0000" : container.borderColor) : "white"
- }
- Rectangle {
- id: indicator
- anchors.left: parent.left
- anchors.top: parent.top
- anchors.topMargin: 15
- anchors.leftMargin: 15
- height: 15
- width: height
- radius: width*0.5
- color: container.standby ? "#ff0000" : "black"
- }
- Image {
- id: iconImage
- anchors.fill: parent
- }
- Text {
- id: textField
- anchors.centerIn: parent
- anchors.fill: parent
- anchors.margins: 3
- color: "white"
- font.pointSize: 12
- wrapMode: Text.Wrap
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
- Audio {
- id: buttonClick
- source: "qrc:/sounds/Click.wav"
- }
- MouseArea {
- enabled: !error
- anchors.fill: parent
- onPressed: {
- buttonModel.pressed = true
- buttonClick.play()
- shadow.radius = 6.0
- }
- onReleased: { buttonModel.pressed = false; shadow.radius = 12.0; }
- }
- Image {
- visible: error
- anchors.fill: parent
- source: "qrc:/images/error_overlay.svg"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement