[Development] Hiding Tabs in QTabWidget

3,411 views
Skip to first unread message

Carsten Breuer

unread,
Mar 26, 2012, 3:43:41 PM3/26/12
to devel...@qt-project.org
Hi guys,


i just spend some hours with trying to hide a tab in a QTabWidget
that was designed with QtCreator (ui).
After searching the web it seems to me that the only way to solve this
is to use the removeTab function.

I don't want to use removeTab, because this means that i have to save
the tab text somewherem, have to deal with translations and with tab
position dependencies and much more. All stuff, that smart Qt should do
for me.

Is there any other function that i can use to hide tabs?
Someone...please :-)


Best Regards,

Carsten
_______________________________________________
Development mailing list
Devel...@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Jordi Pujol

unread,
Mar 27, 2012, 1:51:51 AM3/27/12
to devel...@qt-project.org
Sorry, answer sent only to Carsten ( my mistake... )

> Afaik you only have the option to remove the tab . I've implemented
> that functionality, but right now I cannot contribute it to Gerrit
> ( no maintainer for QWidgets module & no plans... ).
>
> If someone can tell me how to do it I'll be glad to do it for
> Qt5.1 ....
>
> El 26/03/2012 21:43, "Carsten Breuer" <Carsten...@textwork.de>
> escribió:

Diego Iastrubni

unread,
Mar 27, 2012, 3:54:35 AM3/27/12
to Carsten Breuer, devel...@qt-project.org
On Mon, Mar 26, 2012 at 9:43 PM, Carsten Breuer <Carsten...@textwork.de> wrote:
 
Is there any other function that i can use to hide tabs?

Use QTabWidget::tabBar()->hide() to hide all the tabs.
 

Carsten Breuer

unread,
Mar 29, 2012, 7:49:19 AM3/29/12
to devel...@qt-project.org, pisoen...@gmail.com
Hi Jordi,

thanks for the answer. Im looking forward to see
you changes in QT 5.1 :-).


Best Regards,

Carsten

Jordi Pujol

unread,
Mar 29, 2012, 8:29:54 AM3/29/12
to devel...@qt-project.org, Carsten Breuer
Hi Carsten,

I'm working *right now* in the implementation & test of 2 new methods
( I have to say Girish pointed me in the right direction ) :

bool isTabVisible(int index) const;
void setTabVisible(int index, bool);

I'm testing and still with minor painting problems, it looks fine. You
will see soon on gerrit my changes. I hope they get approved...

Best regards,

Jordi.

El dj 29 de 03 de 2012 a les 13:49 +0200, en/na Carsten Breuer va
escriure:


> Hi Jordi,
>
>
>
> thanks for the answer. Im looking forward to see
> you changes in QT 5.1 :-).
>
>
> Best Regards,
>
>
>
> Carsten

Carsten Breuer

unread,
Mar 29, 2012, 3:42:43 PM3/29/12
to Jordi Pujol, devel...@qt-project.org
Hi Jordi,


great :-) Good News :-).

BTW:

I guess in Qt style it should be

bool tabVisible(int index) const;
void setTabVisible(int index, bool);


Thanks a lot and best Regards,

Carsten

André Pönitz

unread,
Apr 2, 2012, 1:40:44 PM4/2/12
to Carsten Breuer, devel...@qt-project.org
On Thu, Mar 29, 2012 at 09:42:43PM +0200, Carsten Breuer wrote:
> Hi Jordi,
>
>
> great :-) Good News :-).
>
> BTW:
>
> I guess in Qt style it should be
>
> bool tabVisible(int index) const;
> void setTabVisible(int index, bool);

Jordi's

bool isTabVisible(int index) const;

was correct, as the function returns a bool.

Andre'

Reply all
Reply to author
Forward
0 new messages