Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
5.2.1
-
None
-
Qt 5.2.1 on X11
Description
Loading a Component in a Loader will set the Loader's size to the item's height (if not specified otherwise). Setting the Loader to inactive later will not reset its height but it will still occupy the space, albeit being empty.
import QtQuick 2.0 import QtQuick.Controls 1.1 Rectangle { id: rect width: 800 height: 600 property Component testRect: Rectangle { width: 200 height: 200 color: "#f90" } Column { Loader { id: testLoader sourceComponent: rect.testRect active: false } Button { text: testLoader.active ? "Disable" : "Enable" onClicked: testLoader.active = !testLoader.active } } }
Press the button, observe the orange rectangle appears and moves the button downwards. Press the button again, the orange rectangle disappears but its space is still occupied.
height: item ? item.height : 0
works around the issue.
Attachments
Issue Links
- relates to
-
QTBUG-70445 Loader in a Layout takes up space when inactive
-
- Reported
-
-
QTBUG-59578 Loader does not change implicit sizes when component reset.
-
- Reported
-