Commit 5c6f9ae1 authored by Pino Toscano's avatar Pino Toscano

reimplement scrollContentsBy() to make scrolling just repaint the damaged areas

imho it looks like an hack, i have to verify why it doesn't actually repaint as needed, but sometimes it skips updates

svn path=/trunk/KDE/kdegraphics/okular/; revision=992772
parent b5f76c6a
......@@ -293,6 +293,7 @@ PageView::PageView( QWidget *parent, Okular::Document *document )
viewport()->setAttribute( Qt::WA_NoSystemBackground );
setAcceptDrops( true );
viewport()->setMouseTracking( true );
viewport()->setAutoFillBackground( false );
// the apparently "magic" value of 20 is the same used internally in QScrollArea
verticalScrollBar()->setSingleStep( 20 );
horizontalScrollBar()->setSingleStep( 20 );
......@@ -2228,6 +2229,18 @@ bool PageView::viewportEvent( QEvent * e )
// do not stop the event
return QAbstractScrollArea::viewportEvent( e );
}
void PageView::scrollContentsBy( int dx, int dy )
{
const QRect r = viewport()->rect();
viewport()->scroll( dx, dy, r );
// HACK manually repaint the damaged regions, as it seems some updates are missed
// thus leaving artifacts around
QRegion rgn( r );
rgn -= rgn & r.translated( dx, dy );
foreach ( const QRect &rect, rgn.rects() )
viewport()->repaint( rect );
}
//END widget events
QList< Okular::RegularAreaRect * > PageView::textSelections( const QPoint& start, const QPoint& end, int& firstpage )
......
......@@ -144,6 +144,8 @@ Q_OBJECT
bool viewportEvent( QEvent *e );
void scrollContentsBy( int dx, int dy );
private:
// draw background and items on the opened qpainter
void drawDocumentOnPainter( const QRect & pageViewRect, QPainter * p );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment