Unsolved QApplication::setStylesheet slows down startup
-
Hello All,
We have an application which has around 500 widgets created at the startup. Widgets are styled by a custom stylesheet sets at QApplication level.QApplication a(argc, argv); QString combined_stylesheet = fileContent(":/stylesheets/main.qss"); a.setStyleSheet(combined_stylesheet);
In my computer, in debug mode, it takes around 40s to load the application. (Windows 10, Core i5). If I didnt set the stylesheet it would load in 10s. Weird thing is, if I set an empty stylesheet, it still takes around 35s to load.
Anyone had similar problem? Any help really appreciated.
Thanks
-
@asanka424 said in QApplication::setStylesheet slows down startup:
setStyleSheet
Try setting it on the QMainWindow instead of QApplication.
-
Is it a large stylesheet? Could you share it?
-
@Jonas-Kvinge Thanks for the response.
I cannot set at MainWindow, as I am using QWidgets in QGraphicsScene. They need styling at Application level. The content of the stylesheet doesn't matter, even with an empty stylesheet the startup time is slow