On 25/10/2017 16:15, Patrick De Visschere wrote:
I do not like much the idea of just restricting the update area, since it seems
very fragile. But we can return to it if needed. There are ways to get all the
coordinates that we need.
I agree. The dimensions passed via update(x,y,w,h) and the actual area painted
must match exactly. I cannot judge the penalty of the screen redraws. I doesn’t
seem to hurt very much.
Nevertheless I have now something which works mostly. There are still problems
when dragging a selection but I believe these can be solved by fine tuning. The
other problem is that when opening a document the screen stil turns black.
I'm afraid the latter problem cannot (easily) be solved.
When opening a document (I used a simple one with 3 lines with 1
character each) viewport()->update() is executed 4x.
2x with update_flags_=ForceDraw and update_strategy=FullScreenUpdate
and 2x with update_strategy=SingleParUpdate
Both FullScreenUpdates are initiated by
TabWorkArea::on_currentTabChanged(), the second one following a
QEvent::FocusIn.
Although the second call is redundant this is probably not an oversight.
Unfortunately since the screen has already been drawn after the first
update(), the tm::drawPargraph code does not redraw it the 2nd time, but
the screen has been erased by qt again after the second update().
pdv