Button.qml Example File
multimedia/video/qmlvideofx/qml/qmlvideofx/Button.qml
import QtQuick 2.0
Rectangle {
id: root
color: "transparent"
height: itemHeight
width: itemWidth
property string text
property color bgColor: "transparent"
property color bgColorSelected: "#14aaff"
property color textColor: "white"
property alias enabled: mouseArea.enabled
property bool active: true
property alias horizontalAlign: text.horizontalAlignment
signal clicked
Rectangle {
anchors { fill: parent; margins: 1 }
color: mouseArea.pressed ? bgColorSelected : bgColor
Text {
id: text
clip: true
text: root.text
anchors { fill: parent; margins: scaledMargin }
font.pixelSize: fontSize
color: textColor
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
MouseArea {
id: mouseArea
anchors.fill: parent
onClicked: {
root.clicked()
}
enabled: active
}
}
}