Add enabled/disable support for CheckBoxes, RadioButtons and Switches plasma components

- The current disabled CheckBoxes, RadioButtons and Switches,
   have less opacity when disabled instead of custom graphics.
   Needs to be defined if this is the expected behaviour.

Signed-off-by: Daker Fernandes Pinheiro <dakerfp@gmail.com>
This commit is contained in:
Daker Fernandes Pinheiro 2011-07-18 18:41:07 -03:00
parent 487d79bce3
commit 4ff2523d13
2 changed files with 11 additions and 5 deletions

View File

@ -36,15 +36,20 @@ Item {
width: surface.width + label.paintedWidth
height: surface.height
opacity: dualButton.enabled ? 1.0 : 0.5 // XXX: temporary solution
function entered() {
shadow.opacity = 0;
hover.opacity = 1;
if (dualButton.enabled) {
shadow.opacity = 0;
hover.opacity = 1;
}
}
function released() {
dualButton.checked = !dualButton.checked;
dualButton.clicked();
if (dualButton.enabled) {
dualButton.checked = !dualButton.checked;
dualButton.clicked();
}
}
Keys.onSpacePressed: entered();

View File

@ -46,7 +46,8 @@ Column {
PlasmaComponents.CheckBox {
height: 30
text: "Check Box 2"
text: "Disabled"
enabled: false
}
PlasmaComponents.CheckBox {