Manage the enabled state of the page thumbnail list's scrollbar.

svn path=/trunk/KDE/kdegraphics/okular/; revision=746598
This commit is contained in:
Eike Hein 2007-12-09 16:31:43 +00:00
parent 76d061b443
commit e1ce407bb7

View file

@ -87,6 +87,7 @@ ThumbnailList::ThumbnailList( QWidget *parent, Okular::Document *document )
// set scrollbars
setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
verticalScrollBar()->setEnabled( false );
setAttribute( Qt::WA_StaticContents );
@ -182,6 +183,9 @@ void ThumbnailList::notifySetup( const QVector< Okular::Page * > & pages, int se
height -= KDialog::spacingHint();
m_pagesWidget->resize( width, height );
// enable scrollbar when there's something to scroll
verticalScrollBar()->setEnabled( viewport()->height() < height );
// request for thumbnail generation
delayedRequestVisiblePixmaps( 200 );
}
@ -444,6 +448,9 @@ void ThumbnailList::viewportResizeEvent( QResizeEvent * e )
newHeight -= KDialog::spacingHint();
m_pagesWidget->resize( newWidth, newHeight );
// enable scrollbar when there's something to scroll
verticalScrollBar()->setEnabled( viewport()->height() < newHeight );
// ensure selected item remains visible
if ( m_selected )
ensureVisible( 0, m_selected->mapToParent( QPoint( 0, 0 ) ).y() + m_selected->height()/2, 0, viewport()->height()/2 );