PDA

View Full Version : QTabWidget performance issue if there are hundreds of tabs



jasonhxs
17th February 2023, 06:01
Hi,

I suffered a performance issue that when QTabWidget already had 2 hundreds of tabs, add 2 hundreds of tabs again will take times (probably 30+ seconds)
I already use "blcokSignals(true)" before insert hundreds of tabs, and set back to false after insertion, seems it can't help speed-up.
Do you have idea about this performance issue, any way to improve the time, thanks.

Here is the call-stack I captured during the hang.
#0 ... in XCheckTypedWindowEvent ()
#1 ... in QETWidget::translateConfigEvent(_XEvent const*) ()
#2 ... in QApplication::x11ProcessEvent(_XEvent*) ()
#3 ... in qmotif_event_dispatcher(_XEvent*) ()
#4 ... in XtDispatchEvent ()
#5 ... in XtAppProcessEvent ()
#6 ... in QtMotif::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()

Ginsengelf
17th February 2023, 08:46
Hi, maybe setUpdatesEnabled(false); on the tab widget might help.

But I personally don't think that I would want to use a widget with 400 tabs inside. Depending on the content of your tabs maybe you can use the content of just one tab, and update it depending on a selection in a combobox or something like that.

Ginsengelf

jasonhxs
17th February 2023, 09:44
Hi, maybe setUpdatesEnabled(false); on the tab widget might help.

But I personally don't think that I would want to use a widget with 400 tabs inside. Depending on the content of your tabs maybe you can use the content of just one tab, and update it depending on a selection in a combobox or something like that.

Ginsengelf



Hi, thanks for the suggestion.
I tried this way and still suffered performance issue, seems the spent time is not reduced.

d_stranz
17th February 2023, 17:25
Really? A GUI with 400 tabs? How can anyone even begin to navigate such a thing much less find one tab hidden in a forest of 399 others?

I think you should take Ginsengelf's advice and look for another way to accomplish the same idea with less visual overload for your users.

jasonhxs
24th February 2023, 09:49
Really? A GUI with 400 tabs? How can anyone even begin to navigate such a thing much less find one tab hidden in a forest of 399 others?

I think you should take Ginsengelf's advice and look for another way to accomplish the same idea with less visual overload for your users.



Hi, thanks for the comment.
I think I found the root-cause, it is because tab's "closable" feature, it will cause slowness if add many tabs.