Results 1 to 2 of 2

Thread: How can I resize QWidgets added to a QTabWidget

  1. #1
    Join Date
    Apr 2010
    Posts
    98
    Thanks
    19
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question How can I resize QWidgets added to a QTabWidget

    Here's the code I wrote:
    Qt Code:
    1. SettingDialog::SettingDialog()
    2. {
    3. ui.setupUi(this);
    4. setLayout(ui.vLayout);
    5. tabWidget = new QTabWidget(this);
    6. ui.vLayout->addWidget(tabWidget);
    7. ...
    8. QMapIterator<QString,QWidget*> i(pages);
    9. while(i.hasNext())
    10. {
    11. i.next();
    12. tabWidget->addTab(i.value(),i.key());
    13. }
    14. }
    To copy to clipboard, switch view to plain text mode 
    I have a QMap<QString,QWidget*> which stores a lot widgets for me.And then I want to add each to a new tab in the tabWidget.
    When I resize this SettingDialog,the tabWidget will be resize too.But the content(the widgets I added) won't resize.I know if I want it auto-resize,I need QLayout.But I don't know how to add the layout.

    ---Edit----
    I have figured it out~
    Last edited by MorrisLiang; 11th May 2010 at 18:06.
    It's not the goodbye that hurts,but the flashback that follow.

  2. #2
    Join Date
    May 2010
    Location
    Somewhere in Southern Germany
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How can I resize QWidgets added to a QTabWidget

    Could you pleas share your solution for everyone?

Similar Threads

  1. Why do some QWidgets create own threads?
    By donglebob in forum Qt Programming
    Replies: 5
    Last Post: 6th July 2010, 17:01
  2. Multiple QWidgets
    By codeman in forum Qt Programming
    Replies: 7
    Last Post: 23rd March 2010, 11:21
  3. Replies: 2
    Last Post: 22nd January 2008, 16:10
  4. QTabWidget->setCornerWidget() unexpected resize.
    By hickscorp in forum Qt Programming
    Replies: 7
    Last Post: 20th December 2006, 14:12
  5. QTableView, add QWidgets
    By xgoan in forum Qt Programming
    Replies: 2
    Last Post: 30th November 2006, 18:34

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.