graphics for checkboxes and radio buttons

This commit is contained in:
Marco Martin 2011-08-30 23:04:45 +02:00
parent 90123fa75e
commit e24624f80c
3 changed files with 44 additions and 8 deletions

View File

@ -22,9 +22,25 @@ import org.kde.plasma.core 0.1 as PlasmaCore
DualStateButton {
id: checkBox
view: Rectangle {
view: PlasmaCore.FrameSvgItem {
imagePath: "widgets/button"
prefix: "normal"
width: 16
height: 16
color: checked ? "green" : "blue"
PlasmaCore.SvgItem {
svg: PlasmaCore.Svg {
id: checkmarkSvg
imagePath: "widgets/checkmarks"
}
elementId: "checkbox"
opacity: checked ? 1 : 0
anchors.fill: parent
Behavior on opacity {
NumberAnimation {
duration: 250
easing.type: Easing.InOutQuad
}
}
}
}
}

View File

@ -20,11 +20,29 @@
import QtQuick 1.0
import org.kde.plasma.core 0.1 as PlasmaCore
//FIXME: this should be round, DualStateButton shouldn't draw the shadow
DualStateButton {
id: radioButton
view: Rectangle {
view: PlasmaCore.FrameSvgItem {
imagePath: "widgets/button"
prefix: "normal"
width: 16
height: 16
color: checked ? "green" : "blue"
PlasmaCore.SvgItem {
svg: PlasmaCore.Svg {
id: checkmarkSvg
imagePath: "widgets/checkmarks"
}
elementId: "radiobutton"
opacity: checked ? 1 : 0
anchors.fill: parent
Behavior on opacity {
NumberAnimation {
duration: 250
easing.type: Easing.InOutQuad
}
}
}
}
}

View File

@ -22,10 +22,14 @@ import org.kde.plasma.core 0.1 as PlasmaCore
DualStateButton {
id: switchItem
view: Rectangle {
view: PlasmaCore.FrameSvgItem {
imagePath: "widgets/frame"
prefix: "sunken"
width: 32
height: 16
Rectangle {
PlasmaCore.FrameSvgItem {
imagePath: "widgets/button"
prefix: "normal"
anchors {
top: parent.top
bottom: parent.bottom
@ -35,9 +39,7 @@ DualStateButton {
Behavior on x {
PropertyAnimation { duration: 100 }
}
color: "green"
}
color: "grey"
}
}