How to put a ComboBox into a GroupBox ?

  • Hi guys,

    I got some issues with putting a ComboBox into a GroupBox. Currently I am using QT 5.5

    I start with the following setup:

    import QtQuick 2.0
    import QtQuick.Layouts 1.1
    import QtQuick.Controls 1.4
    import QtQuick.Controls.Styles 1.4
        columns: 1
        Layout.fillWidth: true
        Layout.fillHeight: true
            model: [ "No items" ]
            Layout.fillWidth: true
            style: ComboBoxStyle{
                label: Text {
                    verticalAlignment: Text.AlignVCenter
                    horizontalAlignment: Text.AlignHCenter
                    color: "red"
                    text: control.currentText

    Looks good, so far. Now I want a frame with a title around that and GroupBox is the perfect element for that. So I just put a GroupBox {<code_above>} around the whole thing right ? But once I do that, my ComboBox starts to look distorted. (ComboBox not scaling with the width properly). It gets better, if I remove my ComboBoxStyle and/or the GridLayout, but it still does not scale the whole width. Even if I apply

    Layout.fillWidth: true
    Layout.fillHeight: true

    for the GroupBox. I also tried to view the QML file with qmlscene, but no difference.

    So how can I get that ComboBox to use the full width just like it does without the GroupBox?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.