Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Theme Support in Application Linked Against Qt5 Static ?
Forum Updated to NodeBB v4.3 + New Features

Theme Support in Application Linked Against Qt5 Static ?

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
1 Posts 1 Posters 186 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rrubberr
    wrote on last edited by
    #1

    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.

    f5c72331-d822-4947-aa9e-e465da26c249-image.png

    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.

    Screenshot from 2024-02-09 15-03-11.png

    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
    

    Screenshot from 2024-02-09 15-03-41.png

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved