Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.6
-
None
-
Linux 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux
Qt Creator 4.4.1
Based on Qt 5.9.2 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit)
Built on Oct 4 2017 04:14:10
From revision 6afdb8bdf9
Desktop Qt 5.6.2 GCC 64bit
C: gcc (x86 64bit in /usr/bin)
C++: gcc (x86 64bit in /usr/bin)
Debugger: gdb
CMake: cmake
CMAKE_CXX_COMPILER:STRING=%\{Compiler:Executable:Cxx}
CMAKE_C_COMPILER:STRING=%\{Compiler:Executable:C}
CMAKE_PREFIX_PATH:STRING=%\{Qt:QT_INSTALL_PREFIX}
QT_QMAKE_EXECUTABLE:STRING=%\{Qt:qmakeExecutable}Linux 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux Qt Creator 4.4.1 Based on Qt 5.9.2 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit) Built on Oct 4 2017 04:14:10 From revision 6afdb8bdf9 Desktop Qt 5.6.2 GCC 64bit C: gcc (x86 64bit in /usr/bin) C++: gcc (x86 64bit in /usr/bin) Debugger: gdb CMake: cmake CMAKE_CXX_COMPILER:STRING=%\{Compiler:Executable:Cxx} CMAKE_C_COMPILER:STRING=%\{Compiler:Executable:C} CMAKE_PREFIX_PATH:STRING=%\{Qt:QT_INSTALL_PREFIX} QT_QMAKE_EXECUTABLE:STRING=%\{Qt:qmakeExecutable}
Description
Hello!
Such a piece of code produces, possibly, a bug:
import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Layouts 1.3 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") GridLayout { rowSpacing: 50 columnSpacing: rowSpacing columns: 1 rows: 1 anchors { fill:parent; margins: rowSpacing; } Rectangle { color: "gray" Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter Layout.maximumHeight: 100 Layout.maximumWidth: 100 Layout.fillWidth: true Layout.fillHeight: true } } }
If you do not use dynamic resizing, everything is alright. If you try to resize the window in this example, you might have the outcome like on the screenshots.
It is expected that content's dimensions are decreased to 0, however, they are frozen on some small number at some point.
To workaround this problem you may read layout width or height properties at the moment of scaling to zero size:
GridLayout { // Added id id: layout rowSpacing: 50 columnSpacing: rowSpacing columns: 1 rows: 1 anchors { fill:parent; margins: rowSpacing; } Rectangle { color: "gray" Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter // Added conditions Layout.maximumHeight: layout.height <= 0 ? 0 : 100 Layout.maximumWidth: layout.width <= 0 ? 0 : 100 Layout.fillWidth: true Layout.fillHeight: true } }
Attachments
Issue Links
- relates to
-
QTBUG-67021 Wrong child size when resizing a ColumnLayout with both anchors and "height" set
- Reported