|
|
|
@ -10,19 +10,20 @@ |
|
|
|
#include "thumbnaillist.h" |
|
|
|
#include "thumbnaillist.h" |
|
|
|
|
|
|
|
|
|
|
|
// qt/kde includes
|
|
|
|
// qt/kde includes
|
|
|
|
#include <qapplication.h> |
|
|
|
#include <QAction> |
|
|
|
#include <qdesktopwidget.h> |
|
|
|
#include <QApplication> |
|
|
|
#include <qevent.h> |
|
|
|
#include <QDesktopWidget> |
|
|
|
#include <qtimer.h> |
|
|
|
|
|
|
|
#include <qpainter.h> |
|
|
|
|
|
|
|
#include <qscrollbar.h> |
|
|
|
|
|
|
|
#include <qsizepolicy.h> |
|
|
|
|
|
|
|
#include <KLocalizedString> |
|
|
|
|
|
|
|
#include <qaction.h> |
|
|
|
|
|
|
|
#include <kdialog.h> |
|
|
|
|
|
|
|
#include <kiconloader.h> |
|
|
|
|
|
|
|
#include <kactioncollection.h> |
|
|
|
|
|
|
|
#include <QIcon> |
|
|
|
#include <QIcon> |
|
|
|
|
|
|
|
#include <QPainter> |
|
|
|
|
|
|
|
#include <QResizeEvent> |
|
|
|
|
|
|
|
#include <QScrollBar> |
|
|
|
|
|
|
|
#include <QSizePolicy> |
|
|
|
|
|
|
|
#include <QStyle> |
|
|
|
|
|
|
|
#include <QTimer> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <KLocalizedString> |
|
|
|
|
|
|
|
#include <KIconLoader> |
|
|
|
|
|
|
|
#include <KActionCollection> |
|
|
|
|
|
|
|
|
|
|
|
// local includes
|
|
|
|
// local includes
|
|
|
|
#include "pagepainter.h" |
|
|
|
#include "pagepainter.h" |
|
|
|
@ -280,7 +281,7 @@ void ThumbnailList::notifySetup( const QVector< Okular::Page * > & pages, int se |
|
|
|
// restoring the previous selected page, if any
|
|
|
|
// restoring the previous selected page, if any
|
|
|
|
if ( (*pIt)->number() < prevPage ) |
|
|
|
if ( (*pIt)->number() < prevPage ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
centerHeight = height + t->height() + KDialog::spacingHint()/2; |
|
|
|
centerHeight = height + t->height() + this->style()->layoutSpacing(QSizePolicy::Frame, QSizePolicy::Frame, Qt::Vertical)/2; |
|
|
|
} |
|
|
|
} |
|
|
|
if ( (*pIt)->number() == prevPage ) |
|
|
|
if ( (*pIt)->number() == prevPage ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -288,11 +289,11 @@ void ThumbnailList::notifySetup( const QVector< Okular::Page * > & pages, int se |
|
|
|
d->m_selected->setSelected( true ); |
|
|
|
d->m_selected->setSelected( true ); |
|
|
|
centerHeight = height + t->height() / 2; |
|
|
|
centerHeight = height + t->height() / 2; |
|
|
|
} |
|
|
|
} |
|
|
|
height += t->height() + KDialog::spacingHint(); |
|
|
|
height += t->height() + this->style()->layoutSpacing(QSizePolicy::Frame, QSizePolicy::Frame, Qt::Vertical); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// update scrollview's contents size (sets scrollbars limits)
|
|
|
|
// update scrollview's contents size (sets scrollbars limits)
|
|
|
|
height -= KDialog::spacingHint(); |
|
|
|
height -= this->style()->layoutSpacing(QSizePolicy::Frame, QSizePolicy::Frame, Qt::Vertical); |
|
|
|
widget()->resize( width, height ); |
|
|
|
widget()->resize( width, height ); |
|
|
|
|
|
|
|
|
|
|
|
// enable scrollbar when there's something to scroll
|
|
|
|
// enable scrollbar when there's something to scroll
|
|
|
|
@ -570,11 +571,11 @@ void ThumbnailListPrivate::viewportResizeEvent( QResizeEvent * e ) |
|
|
|
ThumbnailWidget *t = *tIt; |
|
|
|
ThumbnailWidget *t = *tIt; |
|
|
|
t->move(0, newHeight); |
|
|
|
t->move(0, newHeight); |
|
|
|
t->resizeFitWidth( newWidth ); |
|
|
|
t->resizeFitWidth( newWidth ); |
|
|
|
newHeight += t->height() + KDialog::spacingHint(); |
|
|
|
newHeight += t->height() + this->style()->layoutSpacing(QSizePolicy::Frame, QSizePolicy::Frame, Qt::Vertical); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// update scrollview's contents size (sets scrollbars limits)
|
|
|
|
// update scrollview's contents size (sets scrollbars limits)
|
|
|
|
newHeight -= KDialog::spacingHint(); |
|
|
|
newHeight -= this->style()->layoutSpacing(QSizePolicy::Frame, QSizePolicy::Frame, Qt::Vertical); |
|
|
|
const int oldHeight = q->widget()->height(); |
|
|
|
const int oldHeight = q->widget()->height(); |
|
|
|
const int oldYCenter = q->verticalScrollBar()->value() + q->viewport()->height() / 2; |
|
|
|
const int oldYCenter = q->verticalScrollBar()->value() + q->viewport()->height() / 2; |
|
|
|
q->widget()->resize( newWidth, newHeight ); |
|
|
|
q->widget()->resize( newWidth, newHeight ); |
|
|
|
|