Results 1 to 2 of 2

Thread: Growing the contents of a scroll area.

  1. #1
    Join Date
    Nov 2008
    Posts
    38
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Growing the contents of a scroll area.

    Hello, and thanks for reading.

    Consider a class Foo which is something like
    Qt Code:
    1. Foo :: Foo (QWidget * parent) : QWidget(parent) {
    2. my_layout = new QVBoxLayout (this);
    3. setLayout (my_layout);
    4. }
    5.  
    6. void Foo :: bar () {
    7. my_layout -> addWidget (new SomeWidget());
    8. }
    To copy to clipboard, switch view to plain text mode 

    If Foo inherits from QWidget then it behaves as expected: the height increases to accomodate the contens every time bar() is called.

    If this grows to big I need a vertical scrollbar. However, if Foo inherits from QScrollArea then it does not resize to fit the new contents; rather, the new widgets are squashed together. Ironically, this makes the scrollbar redundant.

    How to I make Foo stack the child widgets correctly as in the non-scrolling version?

    Thanks

  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: Growing the contents of a scroll area.

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. adding items in scroll area dynamically
    By Ezhil in forum Qt Programming
    Replies: 5
    Last Post: 22nd May 2009, 16:33
  2. scroll area like QGraphicsItem
    By Gopala Krishna in forum Qt Programming
    Replies: 1
    Last Post: 7th February 2008, 11:28
  3. abstract scroll area
    By moowy in forum Qt Programming
    Replies: 2
    Last Post: 2nd October 2006, 09:15
  4. QScrollArea's Scroll Bars
    By ToddAtWSU in forum Qt Programming
    Replies: 5
    Last Post: 19th September 2006, 13:27
  5. QRubberBand painting in the scroll area widget
    By SkripT in forum Qt Programming
    Replies: 7
    Last Post: 17th January 2006, 16:48

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.