Results 1 to 6 of 6

Thread: Howto: Setup QScrollArea correct? - e.g. scrolling is not working...

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2009
    Location
    Vienna
    Posts
    91
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    18
    Thanked 5 Times in 5 Posts

    Thumbs up Re: Howto: Setup QScrollArea correct? - e.g. scrolling is not working...

    Hello again,

    today i had the time to solve this problem with your suggestions
    At: http://doc.trolltech.com/latest/qscr...html#setWidget
    is the hint:
    Note that You must add the layout of widget before you call this function; if you add it later, the widget will not be visible - regardless of when you show() the scroll area. In this case, you can also not show() the widget later.

    With QLayout i had some problems, but at last:

    I had to set the minimum size of my custom widget, before i add it to the scrollArea.
    So everytime i change the size of pJob because of adding new functionyllity -eg widgets to it scrollArea will adapt automatically.

    i did at my constructor:

    Qt Code:
    1. ...
    2. m_ui->setupUi(this);
    3. Jobs *pjob = new Jobs();
    4.  
    5. QSize AdjustSize = pjob->size();
    6. AdjustSize.width(); // for debugging...
    7.  
    8. // Adjust scrollArea to this size,
    9. pjob->setMinimumSize(AdjustSize); // Advantage: everytime you change the size of pJob,
    10. // because of adding new functionyllity -eg widgets to it..
    11. // scrollArea will adapt automatically (-:
    12.  
    13. m_ui->scrollArea->setWidgetResizable(true);
    14. m_ui->scrollArea->setWidget(pjob);
    To copy to clipboard, switch view to plain text mode 

    Thank you very much,
    & have a nice day
    Astronomy
    Attached Images Attached Images
    Last edited by Astronomy; 17th September 2010 at 13:14.

  2. #2
    Join Date
    Jun 2013
    Posts
    1
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows Android

    Default Re: Howto: Setup QScrollArea correct? - e.g. scrolling is not working...

    Quote Originally Posted by Astronomy View Post
    Hello again,

    today i had the time to solve this problem with your suggestions ...

    Thanks so much. This is the only explicit example I found on line that explain what's going on with scrollarea created with UI not showing properly issue. Solve my doubt and improve my skill. Thanks again.

Similar Threads

  1. Replies: 5
    Last Post: 19th March 2010, 18:13
  2. transparent QScrollArea and blurry scrolling
    By titanandrews in forum Qt Programming
    Replies: 2
    Last Post: 17th January 2010, 00:35
  3. QScrollArea scrolling down not up
    By ntp in forum Qt Programming
    Replies: 5
    Last Post: 20th August 2008, 17:23
  4. Scrolling bar problem in QScrollArea
    By YuriyRusinov in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2007, 21:22
  5. Replies: 2
    Last Post: 8th October 2006, 20:14

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
  •  
Qt is a trademark of The Qt Company.