Results 1 to 2 of 2

Thread: height of visible part of QScrollArea?

  1. #1
    Join Date
    Apr 2007
    Location
    Rakovnik, Czech Republic
    Posts
    175
    Thanks
    43
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default height of visible part of QScrollArea?

    I have a QScrollArea with a 4,000-pixel (height), custom-painted widget on it. But the actual part of the widget displayed at any given time is more like 400 pixels. How can I determine this number exactly?


    I've tried:
    Qt Code:
    1. myScrollArea->height();
    To copy to clipboard, switch view to plain text mode 

    and

    Qt Code:
    1. QRegion treg = myScrollArea->visibleRegion();
    2. QRect trect = tregion.boundingRect();
    3. qDebug(" height = %d", trect.height() );
    To copy to clipboard, switch view to plain text mode 

    The first returns "480" (though that's not correct), and the 2nd returns 0. Ideas?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: height of visible part of QScrollArea?

    Try myScrollArea->viewport()->height().
    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.


  3. The following user says thank you to wysota for this useful post:

    vonCZ (19th May 2009)

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.