Theme Support in Application Linked Against Qt5 Static ?
-
I have recently converted an application from dynamic to static linking. As part of this preparation, I have compiled Qt5 as a static library with the command shown below.
When compiled with shared libraries, my application uses system-wide theming preferences, defined on my Debian host in qt5ct. In particular, it uses the adwaita-qt style which closely adheres to the design language of my underlying Gnome desktop environment. This is shown below.
However, when linked against static Qt5, the application presents only the two integrated style options: Windows and Fusion. The binary reports:
QApplication: invalid style override ' ' passed, ignoring it. Available styles: Windows, Fusion
I am wondering if there is any way to maintain the static Qt libraries, rather than using system libraries, while also integrating system-wide style support? If not, is there any way to integrate the adwaita style into Qt5 or my application?
My application's current main.cpp for the GUI is as follows:
#include <clocale> //#include <QTranslator> #include "luxapp.hxx" int main(int argc, char *argv[]) { LuxGuiApp application(argc, argv); /* QString locale = QLocale::system().name(); QTranslator translator; if (translator.load(QString("luxrender_") + locale)) application.installTranslator(&translator); */ // force C locale setlocale(LC_NUMERIC,"C"); if (application.mainwin) return application.exec(); else return 0; }
If style support is not possible, perhaps the only solution is to manually change the application's colors.
The project in its entirety can be viewed on GitHub.