Remove unnecessary placeholder
Text.implicitWidth holds the size the text would be if it wasn't truncated
This commit is contained in:
parent
d33aa6dfdf
commit
78684c46cd
@ -71,18 +71,10 @@ Row {
|
||||
x: _s
|
||||
y: _s
|
||||
|
||||
//This instance is purely for metrics
|
||||
PlasmaExtras.Heading {
|
||||
id: tooltipMaintextPlaceholder
|
||||
visible: false
|
||||
level: 3
|
||||
text: toolTip ? toolTip.mainText : ""
|
||||
}
|
||||
PlasmaExtras.Heading {
|
||||
id: tooltipMaintext
|
||||
level: 3
|
||||
width: Math.min(tooltipMaintextPlaceholder.width, preferredTextWidth)
|
||||
//width: 400
|
||||
width: Math.min(tooltipMaintext.implicitWidth, preferredTextWidth)
|
||||
elide: Text.ElideRight
|
||||
text: toolTip ? toolTip.mainText : ""
|
||||
}
|
||||
|
71
tests/tooltip.qml
Normal file
71
tests/tooltip.qml
Normal file
@ -0,0 +1,71 @@
|
||||
import QtQuick 2.2
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
Rectangle {
|
||||
color: "white"
|
||||
width: 600
|
||||
height: 800
|
||||
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: 4
|
||||
|
||||
PlasmaCore.ToolTipArea {
|
||||
width: 300
|
||||
height: 50
|
||||
|
||||
mainText: "This is some really really really really long text that should be truncated"
|
||||
subText: "subtext"
|
||||
|
||||
Rectangle {
|
||||
color: "red"
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.fill: parent
|
||||
text: "long tooltip"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PlasmaCore.ToolTipArea {
|
||||
width: 300
|
||||
height: 50
|
||||
|
||||
mainText: "A"
|
||||
subText: "B"
|
||||
|
||||
Rectangle {
|
||||
color: "red"
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.fill: parent
|
||||
text: "short tooltip"
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaCore.ToolTipArea {
|
||||
width: 300
|
||||
height: 50
|
||||
|
||||
mainText: "A"
|
||||
subText: "Lorem ipsum dolor sit amet, consectetur adipiscing spaghetti italiano random cheesecake blah blah"
|
||||
|
||||
Rectangle {
|
||||
color: "red"
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.fill: parent
|
||||
text: "long subtext"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user