Results 1 to 14 of 14

Thread: QAbstractScrollArea and paintEvent

Hybrid View

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

    Default Re: QAbstractScrollArea and paintEvent

    So why not put a QLabel inside QScrollArea and forget about the whole problem?

    As for the current situation scrollbars will only appear if you declare the viewport size larger than the scrollarea size. Currently you didn't declare anything so the viewport size is practically undetermined. Unless you implement scrollbar handling yourself (setting the sizes and handling moving them) you won't be able to use them.

  2. #2
    Join Date
    Nov 2007
    Posts
    291
    Thanks
    85
    Thanked 1 Time in 1 Post

    Default Re: QAbstractScrollArea and paintEvent

    So why not put a QLabel inside QScrollArea and forget about the whole problem?
    if i need to have zoom and image moving features(through wheel event and mouse move event) ,should i have to reimplement the QLabel.

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

    Default Re: QAbstractScrollArea and paintEvent

    No, you just set the zoomed pixmap to the label. Panning should work out of the box.

  4. #4
    Join Date
    Nov 2007
    Posts
    291
    Thanks
    85
    Thanked 1 Time in 1 Post

    Default Re: QAbstractScrollArea and paintEvent

    So why not put a QLabel inside QScrollArea and forget about the whole problem?
    i am following the same .I need rubberband zooming .Is it possible with QScrollArea.

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

    Default Re: QAbstractScrollArea and paintEvent

    Yes, of course. Use QRubberBand and calculate the zoom rectangle based on the position of the viewport.

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.