Results 1 to 2 of 2

Thread: sizepolicies, QScrollArea, and tabwidgets

  1. #1
    Join Date
    Jul 2009
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default sizepolicies, QScrollArea, and tabwidgets

    i want to add a scrollarea to a tabwidget, and have the scrollarea expand to the available size in its tab.

    i can't seem to get the scrollarea to size properly, it is always either undersized in both directions, or far far too wide and still too short.

    can someone kindly point me in the right direction?

  2. #2
    Join Date
    Sep 2009
    Location
    Aachen, Germany
    Posts
    60
    Thanks
    2
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: sizepolicies, QScrollArea, and tabwidgets

    I guess the simplest thing to do would be to put a layout into the tabpage and the scrollarea into the layout. Like this:

    Qt Code:
    1. QTabWidget *tabWidget = new QTabWidget();
    2. QWidget *widget = new QWidget(tabWidget );
    3. QScrollArea *sa = new QScrollArea(widget );
    4. QVBoxLayout *layout = new QVBoxLayout(widget);
    5.  
    6. layout->addWidget(sa);
    7. tabWidget->addTab(widget, "Tada");
    To copy to clipboard, switch view to plain text mode 

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.