Results 1 to 4 of 4

Thread: Central Widget of QMainWindow

  1. #1
    Join Date
    Jan 2006
    Location
    India
    Posts
    54
    Thanks
    1
    Thanked 7 Times in 6 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Central Widget of QMainWindow

    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

  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: Central Widget of QMainWindow

    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.

  3. #3
    Join Date
    Jan 2006
    Location
    India
    Posts
    54
    Thanks
    1
    Thanked 7 Times in 6 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Central Widget of QMainWindow

    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.
    Last edited by sumsin; 13th March 2006 at 18:35.

  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: Central Widget of QMainWindow

    Quote Originally Posted by sumsin
    Because just like QMainWindow's central widget, it automatically adjust the size.
    So... is it wrong?

Similar Threads

  1. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 08:06
  2. Replies: 2
    Last Post: 7th June 2008, 14:12
  3. QMainWindow setCentralWidget from ui widget, Qt4
    By alan in forum Qt Programming
    Replies: 5
    Last Post: 13th May 2008, 14:00
  4. QDockWidgets without central widget
    By JoeMerchant in forum Qt Programming
    Replies: 17
    Last Post: 8th August 2007, 15:52
  5. paint central widget of a QMainWindow???
    By Shuchi Agrawal in forum Newbie
    Replies: 3
    Last Post: 17th January 2007, 09: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.