Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How can I enable the native Windows style?



  • Some of the Qt 6 material talks about native desktop styles. I'd like to use the Windows one. How can I enable it?

    For example, I can do QQuickStyle::setStyle("Universal"); but QQuickStyle::setStyle("Windows"); doesn't work. Is there anywhere I can see all the possible string values that I can pass to that function?

    I don't see the style listed here here: https://doc-snapshots.qt.io/qt6-dev/qtquickcontrols2-styles.html#available-styles


  • Moderators

    Hi, and welcome!

    @edfasefwfawd said in How can I enable the native Windows style?:

    Some of the Qt 6 material talks about native desktop styles. I'd like to use the Windows one. How can I enable it?

    If I'm not mistaken, it's already enabled by default.

    Just create a basic Qt Quick project and build it with both Qt 5 and Qt 6:

    import QtQuick.Window 2.15
    import QtQuick.Controls 2.5
    
    Window {
    	width: 640
    	height: 480
    	visible: true
    
    	Button {
    		text: "Hello"
    	}
    }
    

    On Windows 10, when using Qt 5, the button is large, flat, and always gray. However, when using Qt 6, the button is smaller with a blue-ish hover effect, just like native Windows buttons.


Log in to reply