diff --git a/ui/thumbnaillist.cpp b/ui/thumbnaillist.cpp index 7e6cb9238..abe35c442 100644 --- a/ui/thumbnaillist.cpp +++ b/ui/thumbnaillist.cpp @@ -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 );