Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.2.1, 5.3.2, 5.4.0
-
None
-
Ubuntu 14.04
Mac OS X 10.10
-
6aef31dcfbee23986646e30553937b390374ac67
Description
Such behavior breaks text eliding, i.e. no ellipsis appears at the end of the fitted string.
See example bellow. Press Enter key to toggle custom layout on and off. With left and right arrows you may decrease and increase text width correspondingly and see the difference. Expectation is that the result should be the same.
import QtQuick 2.2 import QtQuick.Window 2.1 Window { id: root visible: true property bool customLayout: false onCustomLayoutChanged: console.log("custom layout:", customLayout) property int textWidth: 111 onTextWidthChanged: console.log("text width:", textWidth) Text { focus: true text: "one two three four five" width: customLayout ? parent.width : textWidth maximumLineCount: 1 elide: Text.ElideRight onLineLaidOut: if (customLayout) { line.width = textWidth } Rectangle { width: textWidth height: parent.height z: parent.z - 1 color: "salmon" } Component.onCompleted: root.textWidthChanged.connect(doLayout) Keys.onReturnPressed: customLayout = !customLayout Keys.onRightPressed: ++textWidth Keys.onLeftPressed: --textWidth } }