Results 1 to 5 of 5

Thread: Hiding the QTabBar of a QTabWidget

  1. #1
    Join Date
    Jan 2006
    Posts
    368
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Hiding the QTabBar of a QTabWidget

    I have this tab widget, which I want to hide it's tabbar. How can I do this? I wanted to use QTabWidget::tabBar()->hide() but tabBar() is not a public interface.

    The only idea I have is to constcut my own QTabBar, pass it to the QTabWidget and then have full control of that widget outside QTabWidget's interface. I fell this is too ugly to implement, and I am looking for a sane and better implementation.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Hiding the QTabBar of a QTabWidget

    Why would you want to do that? Why not simply take a QStackedWidget instead? It's exactly a QTabWidget without a QTabBar...

  3. #3
    Join Date
    Jan 2006
    Posts
    368
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Hiding the QTabBar of a QTabWidget

    Yes, I tought of that as well (and I implemented this once using a QWorkspace, so I should know how to do this properly). But still, it seems ugly... I am hoping to find some smarter way of doing this.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Hiding the QTabBar of a QTabWidget

    I don't think it's ugly, but if you insist, then use qFindChild (or simmilar) to find the tabbar within the tab widget so that you can access it directly.

  5. #5
    Join Date
    Feb 2007
    Posts
    16
    Thanks
    1
    Platforms
    Windows

    Post Re: Hiding the QTabBar of a QTabWidget

    Quote Originally Posted by elcuco View Post
    Yes, I tought of that as well (and I implemented this once using a QWorkspace, so I should know how to do this properly). But still, it seems ugly... I am hoping to find some smarter way of doing this.
    For some implementations, it's easier using the setHidden(boolean) member on the widgets.

    In most cases, that's pretty ugly, though.

    For example, if you wanted to toggle between 2 widgets, you could use...

    y.setHidden(true);

    Toggle()
    {
    x.setHidden(!x.isHidden());
    y.setHidden(!y.isHidden());
    }
    Last edited by giverson; 26th March 2007 at 15:09.

Similar Threads

  1. Help on QTabBar colors
    By smacchia in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2012, 16:48
  2. Adding QGroupBox to QTabWidget
    By mclark in forum Newbie
    Replies: 2
    Last Post: 17th January 2007, 16:27
  3. QTabWidget Placement and Display
    By mclark in forum Newbie
    Replies: 1
    Last Post: 16th January 2007, 20:34
  4. QTabWidget, QTabBar, double-click the tabText
    By jcr in forum Qt Programming
    Replies: 3
    Last Post: 21st September 2006, 20:44
  5. Customize QTabBar or QTabWidget
    By gtthang in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2006, 08:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.