From e24624f80cbdb06fe6ca3a261f531e121de3ccd1 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 30 Aug 2011 23:04:45 +0200 Subject: [PATCH] graphics for checkboxes and radio buttons --- .../plasmacomponents/CheckBox.qml | 20 +++++++++++++++-- .../plasmacomponents/RadioButton.qml | 22 +++++++++++++++++-- .../plasmacomponents/Switch.qml | 10 +++++---- 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/declarativeimports/plasmacomponents/CheckBox.qml b/declarativeimports/plasmacomponents/CheckBox.qml index 34e45b3f7..3191d32fa 100644 --- a/declarativeimports/plasmacomponents/CheckBox.qml +++ b/declarativeimports/plasmacomponents/CheckBox.qml @@ -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 + } + } + } } } \ No newline at end of file diff --git a/declarativeimports/plasmacomponents/RadioButton.qml b/declarativeimports/plasmacomponents/RadioButton.qml index 68491de10..de14324c5 100644 --- a/declarativeimports/plasmacomponents/RadioButton.qml +++ b/declarativeimports/plasmacomponents/RadioButton.qml @@ -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 + } + } + } } } \ No newline at end of file diff --git a/declarativeimports/plasmacomponents/Switch.qml b/declarativeimports/plasmacomponents/Switch.qml index 49349b753..7b7bf1815 100644 --- a/declarativeimports/plasmacomponents/Switch.qml +++ b/declarativeimports/plasmacomponents/Switch.qml @@ -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" } }