Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.10.1
-
None
-
Windows 10, MinGW x64
Description
I found a strange strange behavior of implicitHeight of the Text in StackLayout + ColumnLayout nesting, which looks like a bug for me.
import QtQuick 2.10 import QtQuick.Layouts 1.3 import QtQuick.Window 2.3 Window { visible: true width: 210 height: 480 title: "qtbug68356" StackLayout { anchors.fill: parent ColumnLayout { Rectangle { Layout.preferredHeight: 40 Layout.fillWidth: true color: "red" } Text { id: text visible: false Layout.leftMargin: 20 Layout.rightMargin: 20 Layout.fillWidth: true wrapMode: Text.Wrap text: "Subtitle. Lorem ipsum dolor sit amet, consectetur adipiscing elit." onVisibleChanged: { if (visible) console.log("onVisibleChanged: ", implicitHeight) } onImplicitHeightChanged: console.log("onImplicitHeightChanged: ", implicitHeight) } MouseArea { Layout.preferredHeight: 40 Layout.fillWidth: true Rectangle { anchors.fill: parent color: "red" } onClicked: text.visible = !text.visible } } } }
If you press 2 times on rectangle, you'll get this:
qml: onImplicitHeightChanged: 16 qml: onImplicitHeightChanged: 16 qml: onVisibleChanged: 16 qml: onImplicitHeightChanged: 48 qml: onVisibleChanged: 48
As you can see implicitHeight of text changes after test has became visible.
So on first time you'll see this:
And on second this:
forceLayout() does not change anything.
Attachments
Issue Links
- relates to
-
QTBUG-99008 Add proper support for height-for-width elements (or WFH) such as Text element
-
- Reported
-