1
votes

I am using a QAbstractScrollArea + a custom QWidget derivative widget as "the" widget (having sizeHint() overriden). The application needs to constantly update the QWidget content during mouseMove (kind of a drag, but not exactly, it is a drawing tool to draw lines between objects, thus the mouse cursor needs to change + the line needs to be drawn on the fly).

The application works fine, e.g. I can render the content properly, scrollbars visible, I can manual update the viewport during scrollContentsBy, etc.

However regardless that I manually fire a update() (or repaint()) call in mouseMoveEvent, the paintEvent will only be called after the "drag" process is over, e.g. the mouseReleaseEvent is fired.

And I'm clueless why this happens. Obviously if I do the update directly within the mouseMoveEvent, it'll be rejected by QPainter (as I can't instantiate a QPainter within the mouseMoveEvent - Qt drops "paintEngine should no longer be called" when trying to do that).

Any suggestion is welcomed :) Thanks,

1

1 Answers

2
votes

Meh, lame me. Never never mix "update()" with "viewport()->update()"