Search code examples
qtqmldarkmode

QML ComboBox breaks dark mode window styling


I am having a really weird issue with the dark mode on windows in connection with a QML ComboBox. I am using Qt 6.5.0 on Windows 11 with MinGW 11.2.0.

The problem I am having is that the dark mode styling auto detection breaks as soon I add a ComboBox to the scene.

Take the following minimal example:

import QtQuick
import QtQuick.Controls

ApplicationWindow {
    width: 800
    height: 600
    visible: true

    menuBar: MenuBar {
        Menu {
            title: qsTr("File")
            Action {
                text: qsTr("&Quit")
                shortcut: StandardKey.Quit
                onTriggered: Qt.quit();
            }
        }
    }

    Rectangle {
        anchors.fill: parent
        color: "darkred"
    }

//    ComboBox {
//        model: ["First", "Second", "Third"]
//    }
}

Everthing look fine, the menu is styled correctly to the system settings. They are set to dark mode.

enter image description here

As soon as I uncomment the ComboBox element in the example above, the styling breaks and menu resorts back to light mode... Am I doing something wrong here or is this a Qt bug? If anybody has some information it would be highly appreciated :)

enter image description here


Solution

  • This was a Qt bug and it is now fixed :)

    https://bugreports.qt.io/browse/QTBUG-113469