PDA

View Full Version : Central Widget of QMainWindow



sumsin
13th March 2006, 17:16
Hi,

Actually i am creating a Main WIndow application which have menu-bar and a tool-bar and ofcourse a central widget.
But my central widget may be one type of widget out of three type say A, B and C. this is controled by a toolbar item (combo box) which contains these three options A, B and C.

For that I created a class say CentralWidget of type QWidget, and I also created three other classes say ClassA, ClassB and ClassC of type QWidget corresponding to A, B and C.

But I am not understanding the relationship among ClassA, ClassB, ClassC and the CentralWidget, so that at runtime I am able to show one of the Widget( ClassA, ClassB, ClassC).

plz guide me.

thanks & regards
sumsin

wysota
13th March 2006, 17:20
I don't exactly understand your problem, but I guess the answer to it is to use QWidgetStack as the central widget with three pages -- objects of classes A, B and C.

sumsin
13th March 2006, 17:29
Actually I want to show files of a perticular directory may be in Icon veiw or in list view or in detailed list view. Can QWidgetstack solve the problem?
Means I make the QWidgetStack as the central widget of QMAinWindow then I add all the three views in its stack and call IconView widget to be visible if I choose A option.
But is there any problem of size...
Because just like QMainWindow's central widget, it automatically adjust the size.

wysota
13th March 2006, 18:32
Because just like QMainWindow's central widget, it automatically adjust the size.

So... is it wrong?