use the font size for control size

This commit is contained in:
Marco Martin 2011-10-10 13:39:16 +02:00
parent 94ad9f8d3f
commit 3da7704b3a
4 changed files with 34 additions and 12 deletions

View File

@ -25,8 +25,14 @@ DualStateButton {
view: PlasmaCore.FrameSvgItem { view: PlasmaCore.FrameSvgItem {
imagePath: "widgets/button" imagePath: "widgets/button"
prefix: "normal" prefix: "normal"
width: 16 width: fontMetricText.height + margins.left
height: 16 height: fontMetricText.height + margins.top
//FIXME: an hack to have font metrics: can we have a proper binding?
Text {
id: fontMetricText
text: "M"
visible: false
}
PlasmaCore.SvgItem { PlasmaCore.SvgItem {
svg: PlasmaCore.Svg { svg: PlasmaCore.Svg {
id: checkmarkSvg id: checkmarkSvg
@ -34,7 +40,10 @@ DualStateButton {
} }
elementId: "checkbox" elementId: "checkbox"
opacity: checked ? 1 : 0 opacity: checked ? 1 : 0
anchors.fill: parent anchors {
fill: parent
margins: parent.margins.left/2
}
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: 250 duration: 250

View File

@ -86,8 +86,8 @@ Item {
bottom: parent.bottom bottom: parent.bottom
left: surfaceLoader.right left: surfaceLoader.right
right: parent.right right: parent.right
// XXX: see how this margin will be set //FIXME: see how this margin will be set
leftMargin: hover.margins.right leftMargin: height/4
} }
color: theme.textColor color: theme.textColor
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter

View File

@ -27,8 +27,14 @@ DualStateButton {
view: PlasmaCore.FrameSvgItem { view: PlasmaCore.FrameSvgItem {
imagePath: "widgets/button" imagePath: "widgets/button"
prefix: "normal" prefix: "normal"
width: 16 width: fontMetricText.height + margins.left
height: 16 height: fontMetricText.height + margins.top
//FIXME: an hack to have font metrics: can we have a proper binding?
Text {
id: fontMetricText
text: "M"
visible: false
}
PlasmaCore.SvgItem { PlasmaCore.SvgItem {
svg: PlasmaCore.Svg { svg: PlasmaCore.Svg {
id: checkmarkSvg id: checkmarkSvg
@ -36,7 +42,10 @@ DualStateButton {
} }
elementId: "radiobutton" elementId: "radiobutton"
opacity: checked ? 1 : 0 opacity: checked ? 1 : 0
anchors.fill: parent anchors {
fill: parent
margins: parent.margins.left/2
}
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: 250 duration: 250

View File

@ -26,10 +26,14 @@ DualStateButton {
view: PlasmaCore.FrameSvgItem { view: PlasmaCore.FrameSvgItem {
imagePath: "widgets/frame" imagePath: "widgets/frame"
prefix: "sunken" prefix: "sunken"
width: 32 width: height * 2
height: 16 height: fontMetricText.height + margins.top
//not used in this control //FIXME: an hack to have font metrics: can we have a proper binding?
property bool shadowVisible Text {
id: fontMetricText
text: "M"
visible: false
}
PlasmaCore.FrameSvgItem { PlasmaCore.FrameSvgItem {
imagePath: "widgets/button" imagePath: "widgets/button"