How could I force ComboBox fill the width when I wrap it in GroupBox(QtQuick control 2)?
Unsolved
QML and Qt Quick
-
Before I wrap the ComboBox inside the Groupbox, width of the ComboBox can fill the width, but after I wrap it by GroupBox, the Layout.fillWidth do not work anymore, how could I fix that?Thanks
import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 Rectangle { id: root width: 480 height: 480 ColumnLayout{ anchors.fill: parent spacing: 5 GroupBox{ title: qsTr("Face database select") Layout.fillWidth: true GridLayout{ columns: 2 Layout.fillWidth: true Label{ text: qsTr("Select DB") } ComboBox{ Layout.fillWidth: true } } } Item{ Layout.fillHeight: true Layout.fillWidth: true } } }
Result after wrap in the GroupBox
-
@jpnurmi-0 Is it possible to make Layout.fillWidth work if I wrap the GridLayout in the GroupBox, I tried to wrap GridLayout by RowLayout, but it do not work either.
import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 Rectangle { id: root width: 480 height: 480 ColumnLayout{ anchors.fill: parent spacing: 5 GroupBox{ title: qsTr("Face database select") Layout.fillWidth: true RowLayout{ Layout.fillWidth: true //with or without this line has no effect GridLayout{ columns: 2 Layout.fillWidth: true Label{ text: qsTr("Select DB") } ComboBox{ Layout.fillWidth: true } } } } Item{ Layout.fillHeight: true Layout.fillWidth: true } } }
Thanks