QAbstractScrollArea scrolled rect

  • I am trying to write a custom widget that inherits from QAbstractScrollArea. On scroll I would like to be able to only paint into the QRect that becomes newly visible after a scroll. However in the paintEvent function QPaintEvent.rect returns the entire viewport area rather than returning the newly visible area.

    In short I am trying to do the following
    a) In scrollContentsBy I would like to just shift the viewport widgets contends by dx, dy so that I dont have to paint the whole viewport again.
    b) In paintEvent then I would like to just paint into the visible invalid rect that got created because of the scroll.

    Any pointers on how to achieve this?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.