Results 1 to 3 of 3

Thread: QTabWidget tab visibility

  1. #1
    Join Date
    Jan 2007
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTabWidget tab visibility

    Hello all,

    I have an application where the user edits various objects onscreen by right clicking on them. The dialog box that opens when the user does this has a QTabWidget in it. The first tab is standard across all of the elements, but the other tabs are not.

    What I want to do, is use Designer to create the tabs for each of the different specialized setup features of the elements and then only display the tabs that are relevent to the particular element being edited. It is also possible that the user might change the type of element they are editing which requires an immediate change to the list of tabs displayed.

    The problem I have run into, which I hadn't expected to, was the ability to hide tabs. I have created the tabs, can set them enabled or not, but disabling them only grays them out, I need them out of sight, but still available for display should the user change to an element that needs them.

    I tried grabbing the pointer to the widget for each tab and using show() and hide() but this didn't have the desired effect, unless I goofed it.

    Anybody got any ideas on how to do this? Otherwise, I'll have to do each of the forms in code and just add and delete pages manually. If I didn't need to be able to dynamically replace the pages, I could have just deleted the ones I didn't need. Oh well.

    Thanks for any thoughts anybody has.

    DCss

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTabWidget tab visibility

    You can use QTabWidget::removeTab() to remove tabs, but make sure you store a pointer to the removed page somewhere, so that you can add it later. You can also design all pages as separate .ui files and fill your tab widget in the code.

  3. #3
    Join Date
    Jan 2007
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTabWidget tab visibility

    Thanks - I'll give it a try!

Similar Threads

  1. QTabWidget with same tabs
    By Djony in forum Qt Programming
    Replies: 20
    Last Post: 24th December 2011, 12:20
  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. Switching off all tabs in QTabWidget
    By Gopala Krishna in forum Qt Programming
    Replies: 7
    Last Post: 30th August 2006, 17:10
  5. Corner widget in QTabWidget doesn't show up
    By ePharaoh in forum Qt Programming
    Replies: 2
    Last Post: 6th April 2006, 17:02

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.