You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
2.1 KiB

10 years ago
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.0
import QtQuick.Controls.Styles 1.1
Rectangle {
id: buttonActionContainer
10 years ago
property string disableStateImg
property string enabledStateImg
property string buttonTooltip
10 years ago
property string buttonShortcut
property bool buttonLeft
property bool buttonRight
10 years ago
signal clicked
10 years ago
color: "transparent"
width: 35
height: 24
10 years ago
function enabled(state)
{
buttonAction.enabled = state;
if (state)
10 years ago
debugImage.source = enabledStateImg;
10 years ago
else
10 years ago
debugImage.source = disableStateImg;
10 years ago
}
Rectangle {
color: "#DCDADA"
width: 10
height: 24
radius: 4
x: 0
visible: buttonLeft
Rectangle {
anchors {
left: parent.left
right: parent.right
top: parent.top
bottom: parent.bottom
10 years ago
bottomMargin: debugImg.pressed ? 0 : 1;
topMargin: debugImg.pressed ? 1 : 0;
}
color: "#FCFBFC"
radius: 3
}
10 years ago
}
Rectangle {
color: "#DCDADA"
width: 10
height: 24
radius: 4
x: 25
visible: buttonRight
Rectangle {
anchors {
left: parent.left
right: parent.right
top: parent.top
bottom: parent.bottom
10 years ago
bottomMargin: debugImg.pressed ? 0 : 1;
topMargin: debugImg.pressed? 1 : 0;
}
color: "#FCFBFC"
radius: 3
}
}
Rectangle {
id: contentRectangle
width: 25
height: 24
color: "#DCDADA"
x: 5
Rectangle {
anchors {
left: parent.left
right: parent.right
top: parent.top
bottom: parent.bottom
10 years ago
bottomMargin: debugImg.pressed ? 0 : 1;
topMargin: debugImg.pressed ? 1 : 0;
}
color: "#FCFBFC"
Image {
id: debugImage
source: enabledStateImg
anchors.centerIn: parent
10 years ago
anchors.topMargin: debugImg.pressed ? 1 : 0;
fillMode: Image.PreserveAspectFit
width: 15
height: 15
}
}
Button {
anchors.fill: parent
id: debugImg
action: buttonAction
10 years ago
style: ButtonStyle {
background: Rectangle {
color: "transparent"
}
}
}
Action {
tooltip: buttonTooltip
id: buttonAction
shortcut: buttonShortcut
onTriggered: {
buttonActionContainer.clicked();
}
}
}
10 years ago
}