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
|
||||
|
||||
Rectangle {
|
||||
id: buttonArea
|
||||
|
||||
signal clicked
|
||||
|
||||
property alias pressed: mouseArea.pressed
|
||||
property bool transparent: false
|
||||
color: pressed?'#33ffffff':(transparent?'#00000000':'#88000000')
|
||||
|
||||
MouseArea {
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
property bool transparent: false
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
onClicked: buttonArea.clicked();
|
||||
color: mouseArea.pressed?'#33ffffff':(mouseArea.transparent?'#00000000':'#88000000')
|
||||
visible: parent.enabled
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
import QtQuick 2.0
|
||||
|
||||
ButtonArea {
|
||||
id: iconMenuItem
|
||||
|
||||
property alias text: label.text
|
||||
property alias iconSource: icon.source
|
||||
|
||||
|
@ -31,6 +33,7 @@ ButtonArea {
|
|||
Image {
|
||||
id: icon
|
||||
anchors.centerIn: parent
|
||||
opacity: iconMenuItem.enabled ? 1 : .2
|
||||
}
|
||||
|
||||
PLabel {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue