mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-12 10:53:09 +00:00
Try to fix again the inifite scroolbar loop
It's still to be improved because it gives you a uncentered page, but better a bit ugly than unusable This fix will be in KDE 4.1.4 BUGS: 160628 svn path=/trunk/KDE/kdegraphics/okular/; revision=894427
This commit is contained in:
parent
acf5922dd4
commit
522ffd00b6
|
@ -132,6 +132,9 @@ public:
|
|||
QTimer * refreshTimer;
|
||||
int refreshPage;
|
||||
|
||||
// infinite resizing loop prevention
|
||||
bool bothScrollbarsVisible;
|
||||
|
||||
// drag scroll
|
||||
QPoint dragScrollVector;
|
||||
QTimer dragScrollTimer;
|
||||
|
@ -1268,6 +1271,17 @@ void PageView::resizeEvent( QResizeEvent *e )
|
|||
return;
|
||||
}
|
||||
|
||||
if ( d->zoomMode == ZoomFitWidth && d->bothScrollbarsVisible && !horizontalScrollBar()->isVisible() && !verticalScrollBar()->isVisible() && qAbs(e->oldSize().height() - e->size().height()) < horizontalScrollBar()->height() * 1.25 )
|
||||
{
|
||||
// this saves us from infinite resizing loop because of scrollbars appearing and disappearing
|
||||
// see bug 160628 for more info
|
||||
// TODO looks are still a bit ugly because things are left uncentered
|
||||
// but better a bit ugly than unusable
|
||||
d->bothScrollbarsVisible = false;
|
||||
widget()->resize( e->size() );
|
||||
return;
|
||||
}
|
||||
|
||||
// start a timer that will refresh the pixmap after 0.2s
|
||||
if ( !d->delayResizeTimer )
|
||||
{
|
||||
|
@ -1276,6 +1290,8 @@ void PageView::resizeEvent( QResizeEvent *e )
|
|||
connect( d->delayResizeTimer, SIGNAL( timeout() ), this, SLOT( slotRelayoutPages() ) );
|
||||
}
|
||||
d->delayResizeTimer->start( 200 );
|
||||
|
||||
d->bothScrollbarsVisible = horizontalScrollBar()->isVisible() && verticalScrollBar()->isVisible();
|
||||
}
|
||||
|
||||
void PageView::keyPressEvent( QKeyEvent * e )
|
||||
|
@ -2881,14 +2897,6 @@ void PageView::slotRelayoutPages()
|
|||
else
|
||||
fullHeight = rowHeight[ pageRowIdx ];
|
||||
|
||||
if (!horizontalScrollBar()->isVisible() && !verticalScrollBar()->isVisible() && fullWidth == viewportWidth &&
|
||||
fullHeight - viewportHeight == 1 && d->zoomMode == ZoomFitWidth)
|
||||
{
|
||||
// this saves us from infinite resizing loop because of scrollbars appearing and disappearing
|
||||
// see bug 160628
|
||||
fullHeight = viewportHeight;
|
||||
}
|
||||
|
||||
// 3) arrange widgets inside cells (and refine fullHeight if needed)
|
||||
int insertX = 0,
|
||||
insertY = fullHeight < viewportHeight ? ( viewportHeight - fullHeight ) / 2 : 0;
|
||||
|
|
Loading…
Reference in a new issue