Important: Please read the Qt Code of Conduct -

Alternate ways of loading in widgets

  • 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

  • Lifetime Qt Champion

    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.

  • @Christian-Ehrlicher said in Alternate ways of loading in widgets:

    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 ( who had a 120x120 QGridLayout of > 10,000 QLabels... ! :)

Log in to reply