Fix text elide in button and toolbutton

Also use a Plasma.Label, instead of doing it on our own
This commit is contained in:
Sebastian Kügler 2013-08-14 05:46:55 +02:00
parent c76b5137e2
commit 2256c5ad1c
2 changed files with 5 additions and 23 deletions

View File

@ -33,6 +33,7 @@ import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.core 2.0 as PlasmaCore
import "private" as Private import "private" as Private
Item { Item {
id: button id: button
@ -236,25 +237,15 @@ Item {
active: shadow.hasOverState && mouse.containsMouse active: shadow.hasOverState && mouse.containsMouse
} }
Text { Label {
id: label id: label
width: parent.width - icon.width - parent.spacing width: parent.width - icon.width - parent.spacing
height: parent.height height: parent.height
font.capitalization: theme.defaultFont.capitalization
font.family: theme.defaultFont.family
font.italic: theme.defaultFont.italic
font.letterSpacing: theme.defaultFont.letterSpacing
font.pointSize: theme.defaultFont.pointSize
font.strikeout: theme.defaultFont.strikeout
font.underline: theme.defaultFont.underline
font.weight: theme.defaultFont.weight
font.wordSpacing: theme.defaultFont.wordSpacing
color: theme.buttonTextColor color: theme.buttonTextColor
horizontalAlignment: icon.valid ? Text.AlignLeft : Text.AlignHCenter horizontalAlignment: icon.valid ? Text.AlignLeft : Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
elide: button.width < button.implicitWidth ? Text.ElideRight : Text.ElideNone elide: Text.ElideRight
} }
} }

View File

@ -358,24 +358,15 @@ Item {
active: delegate.item.hasOverState && mouse.containsMouse active: delegate.item.hasOverState && mouse.containsMouse
} }
Text { Label {
id: label id: label
width: parent.width - icon.width - parent.spacing width: parent.width - icon.width - parent.spacing
height: parent.height height: parent.height
font.capitalization: theme.defaultFont.capitalization
font.family: theme.defaultFont.family
font.italic: theme.defaultFont.italic
font.letterSpacing: theme.defaultFont.letterSpacing
font.pointSize: theme.defaultFont.pointSize
font.strikeout: theme.defaultFont.strikeout
font.underline: theme.defaultFont.underline
font.weight: theme.defaultFont.weight
font.wordSpacing: theme.defaultFont.wordSpacing
color: mouse.containsMouse ? theme.buttonTextColor : theme.textColor color: mouse.containsMouse ? theme.buttonTextColor : theme.textColor
Behavior on color { ColorAnimation { duration: 100 } } Behavior on color { ColorAnimation { duration: 100 } }
elide: Text.ElideRight
horizontalAlignment: icon.valid ? Text.AlignLeft : Text.AlignHCenter horizontalAlignment: icon.valid ? Text.AlignLeft : Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter