Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.5.1, 6.5.2, 6.7.3
-
None
-
Qt 6.3.2, 6.5.1
macOS 13.4.1
Description
TextEdit with textFormat: TextEdit.RichText, white-space:pre-wrap (this is required, because RichText collapses whitespaces by default), wrapMode: Text.Wrap - fails to break text into lines when text exceeds width.
This is a regression since 6.3.2.
I was able to reproduce it only with specific conditions - a combination of some spaces (U+0020) and tab (U+0009).
The long line of spaces is not wrapped (this has changed since 6.3.2, as can be seen on screenshots), and it's kind of expected with white-space:pre-wrap (or not? spaces should be preserved, but probably wrapped also, as regular text)
Spaces alone do not break the wrapping of the rest of text, but once you add a tab, the text wrapping is not working anymore. And this is a regression since 6.3.2. Text wrapping should respect TextEdit's width.
Sample code:
import QtQuick import QtQuick.Window import QtQuick.Layouts Window { width: 640 height: 480 visible: true ColumnLayout { id: layout x: 20 y: 20 width: 200 TextEdit { id: text Layout.fillWidth: true readonly property string _spaces: ' ' readonly property string _tab: ' ' readonly property string _part: 'NoWhitespaceNoWhitespace(<a href="https://doc.qt.io/qt-6/qml-qtquick-textedit.html" style="color:#2b95f0;text-underline-style:solid;">NoSpacesHere</a>)' readonly property string _br: '<br>' readonly property string _text: _spaces + _tab + _part + _part + _br + _part + _br text: '<span style="white-space:pre-wrap">' + _text + '</span>' wrapMode: Text.Wrap textFormat: TextEdit.RichText Rectangle { // to show geometry of TextEdit anchors.fill: parent color: Qt.rgba(0,0,0,0.2) } } } }
( main.qml )