-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.2
-
None
The implicitWidth of a QQuickText is too big, when text is multi-line and wrapMode is Text.Wrap:
Item {
width: 400
height: 400
Rectangle {
y: 100
anchors.horizontalCenter: parent.horizontalCenter
border.color: "orange"
width: content1.implicitWidth
height: content1.implicitHeight
Text { id: content1
text: "Hello, World!\n Hello again!\nNoWrap"
wrapMode: Text.NoWrap
}
}
Rectangle {
y: 200
anchors.horizontalCenter: parent.horizontalCenter
border.color: "orange"
width: content2.implicitWidth
height: content2.implicitHeight
Text { id: content2
text: "Hello, World!\n Hello again!\nWrap"
wrapMode: Text.Wrap
}
}
}
I would expect, that implicitWidth is the same for wrapMode=Text.NoWrap and wrapMode=Text.Wrap.
This is the behaviour for single-line texts.
This was noticed, when investigating, why multi-line tooltips are wider than necessary:
import QtQuick 2.12 import QtQuick.Controls 2.12 ApplicationWindow { width: 640 height: 480 Button { anchors.centerIn: parent text: "test button" HoverHandler { id: hoverHandler2 } ToolTip.visible: hoverHandler2.hovered ToolTip.text: "Multi line\n2nd line\nBox is too wide" } }
- relates to
-
QTBUG-83630 Qt Quick Control 2 Tooltip can be way too big when you have newlines
-
- Closed
-