Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.9.1
-
None
Description
A TextEdit which has no width but was quested for the implicitWidth and got then a text does never recalculate with or implicitWidth. This resulted in a 0 sized TextEdit inside the QtQuickDesigner.
- simple example
import QtQuick 2.6 import QtQuick.Window 2.2 Window { visible: true width: 640 height: 100 title: qsTr("Hello World") property Item sizedRect Rectangle { id: rect anchors.fill: parent Component.onCompleted: { var myComponent = Qt.createComponent("TestText.qml") var textEdit = myComponent.createObject(rect) textEdit.text = "short" print(textEdit.implicitWidth) print("################") textEdit.text = "in contrast to short this is long" print(textEdit.implicitWidth) print(textEdit.width) textEdit.text = "and this not that long" print(textEdit.implicitWidth) print(textEdit.width) sizedRect = textEdit } } Column { y: 50 Rectangle { color: "red" height: 10 width: sizedRect.width } Rectangle { color: "blue" height: 10 width: sizedRect.implicitWidth } } }
- output:
qml: 25 qml: ################ qml: 25 qml: 25 qml: 25 qml: 25
Attachments
Issue Links
- is duplicated by
-
QTBUG-62916 Outline not rendered correctly in preview of default minimum Qt5.8 example
- Closed