Qt 5.8.0 - QApplication: invalid style override passed, ignoring it.
-
Hi
Its sounds like thisif (!QApplicationPrivate::styleOverride.isEmpty()) { const QString style = QApplicationPrivate::styleOverride.toLower(); app_style = QStyleFactory::create(style); if (!app_style) qWarning("QApplication: invalid style override passed, ignoring it."); }
So it sounds like the automatic detection sends something unexpected.
You can set it as param when you start the app
./myapplication -style motifYou can also try
QApplication::setDesktopSettingsAware(false);
BEFORE the app instance.And see what happens.
-
I tried adding setDesktopSettingsAware(false), but I still get the invalid style message.
I'm still testing with the default Qt Widgets application so the code is just:
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication::setDesktopSettingsAware(false); QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
Running a release build of the application from a terminal using -style motif also gives the same message and the application still does not use the GTK3 theme.
-
@Elsworth55
Ok. Might be something with 5.8 and Linux Mint CinnamonYou can try
qDebug() << QStyleFactory::keys();
and
qDebug() << QApplication::style()->metaObject()->className();to see what Style plugins it seems and what is set.
-
QStyleFactory::keys() gives two styles - "Windows" and "Fusion"
QApplication::style()->metaObject()->className() returns "QFusionStyle"
If I start the application with "-style Fusion" the message no longer appears, but it still isn't using the system GTK3 theme.
As you say, it might be an issue with 5.8 on Linux Mint Cinnamon. I think I'll stick with 5.6.2 and give 5.9 a try when that comes out. Thanks a lot for trying to help.
I'm not sure of the proper etiquette in this situation - should the thread be marked as solved or left open for discussion?
-
Hi,
The GTK plugin seems to be missing, one thing you can try is to grab Qt's sources and compile/install just the plugin by hand.
-
The libqgtk plugin was missing in Qt 5.7.0 and 5.7.1, but Qt 5.8.0 has added a new libqgtk3 plugin that replaces the old libqgtk2 plugin that came with 5.6.2.
It's therefore not an issue of the plugin being missing, it just doesn't seem to be working for me, so Qt applications built with 5.8.0 aren't using the system GTK colour scheme.
I think I might be better sticking with 5.6.2.
-
In that case, I'd run ldd on the plugin to see if there's any dependencies missing.
Starting your application with the
QT_DEBUG_PLUGINS
environment variable set to 1 might also give you some clues about what is happening with it. -
I'm a bit clueless when it comes to Linux and I'm not familiar with ldd, but running it gives me this:
linux-vdso.so.1 => (0x00007ffd3f9ac000) libQt5Widgets.so.5 => /home/user/Qt/Qt5.8.0/5.8/gcc_64/lib/libQt5Widgets.so.5 (0x00007f98012fe000) libQt5Core.so.5 => /home/user/Qt/Qt5.8.0/5.8/gcc_64/lib/libQt5Core.so.5 (0x00007f9800bde000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9800836000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9800620000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9800257000) libQt5Gui.so.5 => /home/user/Qt/Qt5.8.0/5.8/gcc_64/lib/libQt5Gui.so.5 (0x00007f97ffabb000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f97ff89e000) libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007f97ff62d000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f97ff323000) libicui18n.so.56 => /home/user/Qt/Qt5.8.0/5.8/gcc_64/lib/libicui18n.so.56 (0x00007f97fee8a000) libicuuc.so.56 => /home/user/Qt/Qt5.8.0/5.8/gcc_64/lib/libicuuc.so.56 (0x00007f97fead2000) libicudata.so.56 => /home/user/Qt/Qt5.8.0/5.8/gcc_64/lib/libicudata.so.56 (0x00007f97fd0ee000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f97fceea000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f97fcce2000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f97fcac7000) libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f97fc8c5000) libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f97fc5b4000) /lib64/ld-linux-x86-64.so.2 (0x000055ec2a2d5000) libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f97fc38a000) libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007f97fc187000) libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007f97fbf83000) libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007f97fbd7c000) libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007f97fbb79000) libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007f97fb94a000) libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f97fb738000) libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f97fb535000) libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f97fb32e000) libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f97fb12c000) libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f97fadf2000) libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f97fabd8000) libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007f97fa9d3000) libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f97fa7b1000) libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007f97fa5aa000) libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f97fa39b000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f97fa12a000) libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f97f9f26000) libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f97f9d1f000)
Running with QT_DEBUG_PLUGINS set to 1 shows two entries related to libqgtk3, but neither show any errors:
Got keys from plugin meta data ("xcb_glx") QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Programming/build-Test-Desktop_Qt_5_8_0_GCC_64bit-Debug/xcbglintegrations" ... loaded library "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/xcbglintegrations/libqxcb-glx-integration.so" QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platformthemes" ... QFactoryLoader::QFactoryLoader() looking at "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platformthemes/libqgtk3.so" Found metadata in lib /home/user/Qt/Qt5.8.0/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/user/Programming/build-Test-Desktop_Qt_5_8_0_GCC_64bit-Debug/platformthemes" ... loaded library "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platformthemes/libqgtk3.so" QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforminputcontexts" ... QFactoryLoader::QFactoryLoader() looking at "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so" Found metadata in lib /home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so, metadata= { "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1", "MetaData": { "Keys": [ "compose", "xim" ] }, "className": "QComposePlatformInputContextPlugin", "debug": false, "version": 329728 }
The thing that appears to be causing the invalid styles message is that it is looking for a styles subdirectory in the build directory, but that directory doesn't exist:
QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Programming/build-Test-Desktop_Qt_5_8_0_GCC_64bit-Debug/styles" ... QApplication: invalid style override passed, ignoring it.
Here's the full output with QT_DEBUG_PLUGINS on:
Starting /home/user/Programming/build-Test-Desktop_Qt_5_8_0_GCC_64bit-Debug/Test... QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms" ... QFactoryLoader::QFactoryLoader() looking at "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms/libqeglfs.so" Found metadata in lib /home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms/libqeglfs.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "eglfs" ] }, "className": "QEglFSIntegrationPlugin", "debug": false, "version": 329728 } Got keys from plugin meta data ("eglfs") QFactoryLoader::QFactoryLoader() looking at "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms/libqlinuxfb.so" Found metadata in lib /home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms/libqlinuxfb.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "linuxfb" ] }, "className": "QLinuxFbIntegrationPlugin", "debug": false, "version": 329728 } Got keys from plugin meta data ("linuxfb") QFactoryLoader::QFactoryLoader() looking at "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms/libqminimal.so" Found metadata in lib /home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms/libqminimal.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "minimal" ] }, "className": "QMinimalIntegrationPlugin", "debug": false, "version": 329728 } Got keys from plugin meta data ("minimal") QFactoryLoader::QFactoryLoader() looking at "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms/libqminimalegl.so" Found metadata in lib /home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms/libqminimalegl.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "minimalegl" ] }, "className": "QMinimalEglIntegrationPlugin", "debug": false, "version": 329728 } Got keys from plugin meta data ("minimalegl") QFactoryLoader::QFactoryLoader() looking at "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms/libqoffscreen.so" Found metadata in lib /home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms/libqoffscreen.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "offscreen" ] }, "className": "QOffscreenIntegrationPlugin", "debug": false, "version": 329728 } Got keys from plugin meta data ("offscreen") QFactoryLoader::QFactoryLoader() looking at "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms/libqvnc.so" Found metadata in lib /home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms/libqvnc.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "vnc" ] }, "className": "QVncIntegrationPlugin", "debug": false, "version": 329728 } Got keys from plugin meta data ("vnc") QFactoryLoader::QFactoryLoader() looking at "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms/libqxcb.so" Found metadata in lib /home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms/libqxcb.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "xcb" ] }, "className": "QXcbIntegrationPlugin", "debug": false, "version": 329728 } Got keys from plugin meta data ("xcb") QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Programming/build-Test-Desktop_Qt_5_8_0_GCC_64bit-Debug/platforms" ... loaded library "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforms/libqxcb.so" loaded library "Xcursor" QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/xcbglintegrations" ... QFactoryLoader::QFactoryLoader() looking at "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/xcbglintegrations/libqxcb-egl-integration.so" Found metadata in lib /home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/xcbglintegrations/libqxcb-egl-integration.so, metadata= { "IID": "org.qt-project.Qt.QPA.Xcb.QXcbGlIntegrationFactoryInterface.5.5", "MetaData": { "Keys": [ "xcb_egl" ] }, "className": "QXcbEglIntegrationPlugin", "debug": false, "version": 329728 } Got keys from plugin meta data ("xcb_egl") QFactoryLoader::QFactoryLoader() looking at "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/xcbglintegrations/libqxcb-glx-integration.so" Found metadata in lib /home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/xcbglintegrations/libqxcb-glx-integration.so, metadata= { "IID": "org.qt-project.Qt.QPA.Xcb.QXcbGlIntegrationFactoryInterface.5.5", "MetaData": { "Keys": [ "xcb_glx" ] }, "className": "QXcbGlxIntegrationPlugin", "debug": false, "version": 329728 } Got keys from plugin meta data ("xcb_glx") QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Programming/build-Test-Desktop_Qt_5_8_0_GCC_64bit-Debug/xcbglintegrations" ... loaded library "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/xcbglintegrations/libqxcb-glx-integration.so" QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platformthemes" ... QFactoryLoader::QFactoryLoader() looking at "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platformthemes/libqgtk3.so" Found metadata in lib /home/user/Qt/Qt5.8.0/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/user/Programming/build-Test-Desktop_Qt_5_8_0_GCC_64bit-Debug/platformthemes" ... loaded library "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platformthemes/libqgtk3.so" QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforminputcontexts" ... QFactoryLoader::QFactoryLoader() looking at "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so" Found metadata in lib /home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so, metadata= { "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1", "MetaData": { "Keys": [ "compose", "xim" ] }, "className": "QComposePlatformInputContextPlugin", "debug": false, "version": 329728 } Got keys from plugin meta data ("compose", "xim") QFactoryLoader::QFactoryLoader() looking at "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so" Found metadata in lib /home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so, metadata= { "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1", "MetaData": { "Keys": [ "ibus" ] }, "className": "QIbusPlatformInputContextPlugin", "debug": false, "version": 329728 } Got keys from plugin meta data ("ibus") QFactoryLoader::QFactoryLoader() looking at "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so" Found metadata in lib /home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so, metadata= { "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1", "MetaData": { "Keys": [ "qtvirtualkeyboard" ] }, "className": "QVirtualKeyboardPlugin", "debug": false, "version": 329728 } Got keys from plugin meta data ("qtvirtualkeyboard") QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Programming/build-Test-Desktop_Qt_5_8_0_GCC_64bit-Debug/platforminputcontexts" ... loaded library "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so" QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/styles" ... QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Programming/build-Test-Desktop_Qt_5_8_0_GCC_64bit-Debug/styles" ... QApplication: invalid style override passed, ignoring it. QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/accessible" ... QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Programming/build-Test-Desktop_Qt_5_8_0_GCC_64bit-Debug/accessible" ... QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Qt/Qt5.8.0/5.8/gcc_64/plugins/accessiblebridge" ... QFactoryLoader::QFactoryLoader() checking directory path "/home/user/Programming/build-Test-Desktop_Qt_5_8_0_GCC_64bit-Debug/accessiblebridge" ...
It's quite late now, so I best go to bed, but tomorrow I'll download Fedora and give it a try in that. If that doesn't work I'll just keep using 5.6.2.
Edit: I can't get it to work so I'm using 5.6.2. I'm new to both Qt and inexperienced with Linux so I'm probably not the best person to tackle this problem. I'll keep an eye on the forum and hopefully somebody else will have the same issue and a resolution will be found.
-
This message still shows up in Qt 5.10.1 in Linux Mint Cinnamon 18
Like the OP I am new to programming in Qt.
-
[EDIT]: I found a better workaround for my own C++ code. Add one line to the main() function, like this (or use the second line with the desired style name):
int main(int argc, char *argv[]) { qputenv("QT_STYLE_OVERRIDE",""); // qputenv("QT_STYLE_OVERRIDE","Fusion"); ....
[OLD ANSWER]:
Error message: QApplication: invalid style override passed, ignoring it. To remove this error message: In Qt Creator (ver 4.4.1) Select "Projects" (wrench icon on left edge) Under "Build & Run" (left pane) Select "Run" Under "Run Settings" (right pane) Under "Run Environment" Select "Details" (drop down list) Scroll down to "QT_STYLE_OVERRIDE" Click it to highlight it Then click "Unset" button (right side) Click "Details" to close the list Now when you run the application you shouldn't see this error message.
-
-
This happens in 6.8.0 as well, for some reason only the Fusion and Windows alternate styles are available, no gtk2/gtk3. I had no problems with ~5.8, but I USED TO have that problem with that version back in the day. It wasn't a happy experience let me tell ya :3
The problem is, as Qt is being developed, the closer you are to the 'bleeding edge' versions, the less items are compiled in or ported to that version so if you are wanting full environmental compatibility you might want to stay back a few versions to avoid this. The only reason you'd really need to hang out near the bleeding edge is if there are features you program "just has to have" in order to work.
You can turn these on and compile them yourself, yes, but don't be surprised when you run into errors (and I would expect there to be) that you will have to sort out yourself until they are officially done or possibly get someone else to do it (offer them food, that works sometimes :3)
Since the themes are really last-hat, they won't get to those until every other thing is working smoothly, and you may have to wait until other versions 'catch up'.
I remember waiting a considerable time for 5.8 and compiled it myself spending far too much time patching, and wondering if it was worth it--in the end other things forced me back to earlier versions anyway (specifically some older KDevelop controls and stuff wasn't integrating with the new Qt). So be sure to take the time to think about everything you would have to gain or lose before going ahead to the newest/latest versions and whether or not it would be worth it for you in the long run. :3