PDA

View Full Version : Add multiple widget to QTabWidget Tab



Rooster
28th October 2010, 18:28
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.

tbscope
28th October 2010, 18:34
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.

Rooster
28th October 2010, 18:50
ok, I got the parent child thing working great. But how would I use a layout to control them?

Zlatomir
28th October 2010, 18:57
Using layouts (http://doc.qt.nokia.com/4.6/tutorials-widgets-windowlayout.html), nested layouts (http://doc.qt.nokia.com/4.6/tutorials-widgets-nestedlayouts.html) tutorial.
QLayout (http://doc.trolltech.com/4.7/qlayout.html) class reference (look at "inherited by")

Rooster
28th October 2010, 19:06
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.

ChrisW67
28th October 2010, 22:07
Read through the Tab Dialog Example (http://doc.qt.nokia.com/latest/dialogs-tabdialog.html) or in Assistant for inspiration