Maybe you reimplemented drawContents incorrectly? QScrollView should trigger a paint event (and eventually drawContents) after part of the widget gets obscured. Could you give more details, what exactly did you do?
Maybe you reimplemented drawContents incorrectly? QScrollView should trigger a paint event (and eventually drawContents) after part of the widget gets obscured. Could you give more details, what exactly did you do?
Here is my code :
Qt Code:
{ pmp->setBrush( white ); pmp->setPen( NoPen ); pmp->drawRect( 0, 0, cw, ch); pmp->setPen( black ); pmp->translate( -cx, -cy ); //My drawing code. Everything is done useing pmp pmp->end(); p->drawPixmap( cx, cy, pm ); p->end(); delete pmp; }To copy to clipboard, switch view to plain text mode
Thanks a lot
Mithin
www.mithin.in
I think the translation might be messing the things up (I think the code is incorrect). Try getting rid of the pixmap at all and draw the whole viewport directly. If it helps, you can then optimise some things to get better results.
Here is the new code :
Qt Code:
{ //QPixmap pm(cw, ch); //QPainter *pmp = new QPainter( &pm ); pmp->setBrush( white ); pmp->setPen( NoPen ); pmp->drawRect( 0, 0, cw, ch); //pmp->setPen( black ); //pmp->translate( -cx, -cy ); //My drawing code }To copy to clipboard, switch view to plain text mode
It did not solve the first problem. Also, now flickering is introduced.
Does this has to do something with contentsHeight and contentsWidth ?
Thanks a lot for your time
Mithin
www.mithin.in
How about:
Qt Code:
{ pmp->setClipRect(cx,cy,cw,ch); pmp->setClipping(true); pmp->fill(Qt::white); //Your drawing code }To copy to clipboard, switch view to plain text mode
It does not work.
Also, if I do not translate, and when scrollbars appear, all the drawing is messed up.
Please Help
Thanks a lot
Mithin
www.mithin.in
It should work. Did you reimplement some other methods too? Maybe the viewport isn't set up correctly?
Bookmarks