[Solved] Hiding tab from QTabWidget made in QtCreator
-
Hi,
I am using QtCreator and have implemented a QTabWidget on my MainWindow. With the designer, I have 4 tabs that all include layouts / a ton of UI elements / etc.
I haven't been able to figure this out yet but is there a way to "hide" a specific tab if it was created in the designer? I would like to hide and show specific tabs with respect to what the user selects.
I know if you generate it through code then you can add / remove references to tabs as you please, but unfortunately this isn't really an option for me at this moment in time.
Thanks.
-
There's no built in method like setTabVisible(false) unfortunately.
The workaround I often use is applying this stylesheet:
@
QTabWidget::tab:disabled { width: 0; height: 0; margin: 0; padding: 0; border: none; }
@
and then using setTabEnabled(false).
Of course if you also need disabled (grayed out) tabs this method won't work. -
[quote author="Krzysztof Kawa" date="1359565812"]There's no built in method like setTabVisible(false) unfortunately.
The workaround I often use is applying this stylesheet:
@
QTabWidget::tab:disabled { width: 0; height: 0; margin: 0; padding: 0; border: none; }
@
and then using setTabEnabled(false).
Of course if you also need disabled (grayed out) tabs this method won't work.[/quote]Nice trick, thanks for posting!