Commit a0dfb620 authored by Enrico Ros's avatar Enrico Ros
Browse files

update ThumbnailList's ThumbnailWidgets when changing rendermode.

svn path=/branches/kpdf_experiments/kdegraphics/kpdf/; revision=361149
parent 3e6c9356
......@@ -399,7 +399,7 @@ void Part::slotNewConfig()
// TODO do this only when changing Settings::renderMode()
m_pageView->updateContents();
if ( showLeft && m_thumbnailList->isShown() )
m_thumbnailList->updateContents();
m_thumbnailList->updateWidgets();
}
void Part::slotPrintPreview()
......
......@@ -161,6 +161,25 @@ void ThumbnailList::notifyPixmapChanged( int pageNumber )
}
}
void ThumbnailList::updateWidgets()
{
// find all widgets that intersects the viewport and update them
QRect viewportRect( contentsX(), contentsY(), visibleWidth(), visibleHeight() );
QValueVector<ThumbnailWidget *>::iterator tIt = m_thumbnails.begin(), tEnd = m_thumbnails.end();
for ( ; tIt != tEnd; ++tIt )
{
ThumbnailWidget * t = *tIt;
QRect widgetRect( childX( t ), childY( t ), t->width(), t->height() );
if ( viewportRect.intersects( widgetRect ) )
{
// update only the exposed area of the widget (saves pixels..)
QRect relativeRect = viewportRect.intersect( widgetRect );
relativeRect.moveBy( -widgetRect.left(), -widgetRect.top() );
t->update( relativeRect );
}
}
}
void ThumbnailList::dragEnterEvent( QDragEnterEvent * ev )
{
ev->accept();
......
......@@ -42,6 +42,9 @@ Q_OBJECT
// redraw thumbnail ( inherited as DocumentObserver )
void notifyPixmapChanged( int pageNumber );
// redraw visible widgets (useful for refreshing contents...)
void updateWidgets();
protected:
// scroll up/down the view
void keyPressEvent( QKeyEvent * e );
......
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