[aurorae] Fix MaximizeRestore Button of Aurorae Themes

Seems like porting to new infrastructure was incomplete. The
MaximizeRestore button consists of two buttons on top of each other with
an own mouse area in each and both always visible. This means the restore
button was stealing the mouse events of the maximize button breaking
maximization.

The solution is to have an additional MouseArea which controls the whole
button making the two button types just visualization.
This commit is contained in:
Martin Gräßlin 2014-07-07 08:38:41 +02:00
parent e8e650b9f2
commit 558e357575

View file

@ -21,11 +21,17 @@ Item {
id: button
width: auroraeTheme.buttonWidthMaximizeRestore * auroraeTheme.buttonSizeFactor
height: auroraeTheme.buttonHeight * auroraeTheme.buttonSizeFactor
property bool hovered: false
property bool pressed: false
property bool toggled: false
AuroraeButton {
id: maximizeButton
anchors.fill: parent
buttonType: DecorationOptions.DecorationButtonMaximizeRestore
opacity: (!decoration.maximized || auroraeTheme.restoreButtonPath == "") ? 1 : 0
hovered: button.hovered
pressed: button.pressed
toggled: button.toggled
Behavior on opacity {
NumberAnimation {
duration: auroraeTheme.animationTime
@ -37,10 +43,27 @@ Item {
anchors.fill: parent
buttonType: DecorationOptions.DecorationButtonMaximizeRestore + 100
opacity: (decoration.maximized && auroraeTheme.restoreButtonPath != "") ? 1 : 0
hovered: button.hovered
pressed: button.pressed
toggled: button.toggled
Behavior on opacity {
NumberAnimation {
duration: auroraeTheme.animationTime
}
}
}
MouseArea {
anchors.fill: parent
acceptedButtons: {
return Qt.LeftButton | Qt.RightButton | Qt.MiddleButton;
}
hoverEnabled: true
onEntered: button.hovered = true
onExited: button.hovered = false
onPressed: button.pressed = true
onReleased: button.pressed = false
onClicked: {
decoration.maximize(mouse.button);
}
}
}