plasma qml components: highlight dualstate button also on focus

highlight dualstate button also on focus + codecleanup in dualstate button

REVIEW: 105232
This commit is contained in:
Johannes Tröscher 2012-06-20 20:09:34 +02:00
parent ed1e691b2d
commit 7d2b4427ba

View File

@ -74,12 +74,6 @@ Item {
// disabled buttons // disabled buttons
opacity: dualButton.enabled ? 1.0 : 0.5 opacity: dualButton.enabled ? 1.0 : 0.5
function entered() {
if (dualButton.enabled) {
shadowLoader.state = "hover"
}
}
function released() { function released() {
if (dualButton.enabled) { if (dualButton.enabled) {
dualButton.checked = !dualButton.checked; dualButton.checked = !dualButton.checked;
@ -87,8 +81,6 @@ Item {
} }
} }
Keys.onSpacePressed: entered();
Keys.onReturnPressed: entered();
Keys.onReleased: { Keys.onReleased: {
if(event.key == Qt.Key_Space || if(event.key == Qt.Key_Space ||
event.key == Qt.Key_Return) event.key == Qt.Key_Return)
@ -98,6 +90,7 @@ Item {
Loader { Loader {
id: shadowLoader id: shadowLoader
anchors.fill: surfaceLoader anchors.fill: surfaceLoader
state: (dualButton.enabled && (dualButton.focus || mouseArea.containsMouse)) ? "hover" : "shadow"
} }
Loader { Loader {
@ -133,11 +126,6 @@ Item {
hoverEnabled: true hoverEnabled: true
onReleased: dualButton.released(); onReleased: dualButton.released();
onEntered: dualButton.entered();
onPressed: dualButton.forceActiveFocus(); onPressed: dualButton.forceActiveFocus();
onExited: {
shadowLoader.state = "shadow"
}
} }
} }