Results 1 to 6 of 6

Thread: Add multiple widget to QTabWidget Tab

  1. #1
    Join Date
    Feb 2008
    Posts
    25
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Add multiple widget to QTabWidget Tab

    I know this is stupid question, but I was wondering how to add multiple widgets to a QTabWidget Tab? Any help with this would be greatly appreciated.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Add multiple widget to QTabWidget Tab

    Widgets can contain other widgets. There's a parent child relationship which can result in a tree of widgets. You add the parent widget to the tab.
    Use layouts to arrange the widgets.

  3. #3
    Join Date
    Feb 2008
    Posts
    25
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Add multiple widget to QTabWidget Tab

    ok, I got the parent child thing working great. But how would I use a layout to control them?

  4. #4
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Add multiple widget to QTabWidget Tab

    Using layouts, nested layouts tutorial.
    QLayout class reference (look at "inherited by")

  5. #5
    Join Date
    Feb 2008
    Posts
    25
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Add multiple widget to QTabWidget Tab

    I added the widgets to a QHBoxLayout. But they still look stacked on top of each other in the tab.

    I tried to use the QTabWidget setLayout option, but that didn't work out so well for me.

    I know I am missing something ridiculously stupid here.

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Add multiple widget to QTabWidget Tab

    Read through the Tab Dialog Example or in Assistant for inspiration

  7. The following user says thank you to ChrisW67 for this useful post:

    Rooster (12th November 2010)

Similar Threads

  1. How to add close button to each tab widget Qtabwidget?
    By kishore7771 in forum Qt Programming
    Replies: 3
    Last Post: 4th April 2010, 08:42
  2. Replies: 1
    Last Post: 4th March 2010, 17:57
  3. QTabWidget multiple tab show problem!
    By bangqianchen in forum Qt Programming
    Replies: 2
    Last Post: 14th January 2010, 00:09
  4. QTabWidget: corner widget is not shown
    By dv_ in forum Qt Programming
    Replies: 1
    Last Post: 18th March 2008, 17:30
  5. Replies: 0
    Last Post: 21st December 2006, 11:48

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.