#306·qt

GTK and Native styles not available

Author: Fornax96Created May 2, 2017Updated Feb 17, 2026

I noticed that applications built with these bindings use Fusion style by default instead of the native style, so I was trying to set it to GTK manually with this line of code: widgets.QApplication_SetStyle2("GTK"). But when I execute it it only prints this message to stdout: QApplication: invalid style override passed, ignoring it.. When I print the available styles it only shows Windows and Fusion.

I am using Go 1.8.1 and Qt 5.8 on Linux Mint 18 Cinnamon with the Mint-Y-Dark theme.

In my Qt install directory I can see that libqgtk3.so is present in plugins/platformthemes. When I run my application with QT_DEBUG_PLUGINS=1 it also shows that the library is being loaded:

QFactoryLoader::QFactoryLoader() checking directory path "/home/wim/Programs/qt/5.8/gcc_64/plugins/platformthemes" ...
QFactoryLoader::QFactoryLoader() looking at "/home/wim/Programs/qt/5.8/gcc_64/plugins/platformthemes/libqgtk3.so"
Found metadata in lib /home/wim/Programs/qt/5.8/gcc_64/plugins/platformthemes/libqgtk3.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
    "MetaData": {
        "Keys": [
            "gtk3"
        ]
    },
    "className": "QGtk3ThemePlugin",
    "debug": false,
    "version": 329728
}


Got keys from plugin meta data ("gtk3")
QFactoryLoader::QFactoryLoader() checking directory path "/home/wim/Documents/Workspace/go/src/fornax96.me/qt_test/deploy/linux/platformthemes" ...
loaded library "/home/wim/Programs/qt/5.8/gcc_64/plugins/platformthemes/libqgtk3.so"

Even when running the application with -style GTK it still uses Fusion.

Is there any way to make it use the native platform style?