Simplify ButtonArea and IconMenuItem (and add support for "enabled")
This commit is contained in:
parent
eefbe0db27
commit
8561b9c49a
2 changed files with 8 additions and 11 deletions
|
@ -20,19 +20,13 @@
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: buttonArea
|
|
||||||
|
|
||||||
signal clicked
|
|
||||||
|
|
||||||
property alias pressed: mouseArea.pressed
|
|
||||||
property bool transparent: false
|
|
||||||
color: pressed?'#33ffffff':(transparent?'#00000000':'#88000000')
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
anchors.fill: parent
|
property bool transparent: false
|
||||||
onClicked: buttonArea.clicked();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: mouseArea.pressed?'#33ffffff':(mouseArea.transparent?'#00000000':'#88000000')
|
||||||
|
visible: parent.enabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
|
||||||
ButtonArea {
|
ButtonArea {
|
||||||
|
id: iconMenuItem
|
||||||
|
|
||||||
property alias text: label.text
|
property alias text: label.text
|
||||||
property alias iconSource: icon.source
|
property alias iconSource: icon.source
|
||||||
|
|
||||||
|
@ -31,6 +33,7 @@ ButtonArea {
|
||||||
Image {
|
Image {
|
||||||
id: icon
|
id: icon
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
opacity: iconMenuItem.enabled ? 1 : .2
|
||||||
}
|
}
|
||||||
|
|
||||||
PLabel {
|
PLabel {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue