Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.3, 5.15.0
-
None
-
macOS 10.14.6, Qt 5.15.0, Qt 5.12.3, Qt 5.9.8
Description
When a Column or ColumnLayout is not visible, making content items not visible keeps the positioner/layout size unchanged until it becomes visible again. This is a problem when parent or root view is made invisible, the declarative layout does not work as expected.
Reproduction steps:
- Run the attached code
- Click right button twice to make button invisible and visible
- (Observe layout changes)
- Click left button to make column invisible
- Click right button to make button invisible
- Click left button to make column visible
Expected:
Column should have no height
Actual:
Columne has height of invisible button
Reproduction:
Always
Workaround:
Change button width or height to 0 when invisible
import QtQuick 2.9 import QtQuick.Window 2.0 import QtQuick.Controls 1.0 import QtQuick.Layouts 1.0 Window { visible: true width: 640 height: 320 title: qsTr("Buttonmind") property bool buttonVisible: true Button { id: hideAndSeek width: 150 anchors.left: parent.left text: "Show/hide Column" onClicked: layout.visible = !layout.visible } Text { anchors { top: hideAndSeek.bottom topMargin: 5 horizontalCenter: hideAndSeek.horizontalCenter } text: layout.visible ? "Layout visible" : "Layout hidden" } Button { id: buttonToggler anchors.right: parent.right width: 150 text: "Show/hide Button" onClicked: buttonVisible = !buttonVisible } Text { anchors { top: buttonToggler.bottom topMargin: 5 horizontalCenter: buttonToggler.horizontalCenter } text: buttonVisible ? "Button visible" : "Button hidden" } Column { id: layout visible: true anchors { horizontalCenter: parent.horizontalCenter top: parent.top topMargin: 50 } Button { id: button width: 150 // workaround: visible ? 150 : 0 text: "Button" visible: buttonVisible onClicked: buttonVisible = !buttonVisible } } Rectangle { anchors.fill: layout color: "transparent" border { width: 2 color: "green" } } Rectangle { anchors { top: layout.bottom topMargin: 5 horizontalCenter: layout.horizontalCenter } width: 250 height: 30 color: "grey" Text { anchors.centerIn: parent color: "white" text: "Green rectangle anchors to Column" } } }
Attachments
Issue Links
- is required for
-
QTBUG-95209 FontDialog doesn't react well to being resized
- Reported