Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Alternate ways of loading in widgets
joem last edited by
I have a dialog which creates a bunch of tabs full of widgets. These widgets are various number pickers, buttons and text fields and are all relatively custom.
It takes nearly 1 second to initialize when trying to show the dialog.. which feels slow. From my understanding I can't create any widgets besides the main GUI thread, so I can't really work in parallel to speed it up.
Preloading and just not showing the dialog from my main window would work (I'm willing to sacrifice the memory usage). But is there a way to call this that wouldn't slow down the mains initialization? Some sort of an after load task? If I just put it in the constructor it'll slow that down as well
I never seen any widget which is that full that it takes 1second to load. If you don't create more than maybe 1000 widgets (which I doubt - otherwise the user would not be able to see and understand anything on your widget) you must be doing something wrong. Maybe you do some time consuming stuff in the ctors of your widgets.
JonB last edited by JonB
If you don't create more than maybe 1000 widgets
Agree totally with your post, presumably OP has time-consuming constructors. But for the record, you might recall just the other day on this forum we were answering another user question (https://forum.qt.io/topic/119450/crash-when-add-to-many-qwidgets-to-qvector/5) who had a 120x120
QGridLayoutof > 10,000
QLabels... ! :)