@ -853,11 +853,12 @@ void PageView::displayMessage( const QString & message, const QString & details,
void PageView : : reparseConfig ( )
{
// set the scroll bars policies
setHorizontalScrollBarPolicy ( Qt : : ScrollBarAlwaysOff ) ;
Qt : : ScrollBarPolicy scrollBarMode = Okular : : Settings : : showScrollBars ( ) ?
Qt : : ScrollBarAsNeeded : Qt : : ScrollBarAlwaysOff ;
if ( horizontalScrollBarPolicy ( ) ! = scrollBarMode )
{
setHorizontalScrollBarPolicy ( scrollBarMode ) ;
setHorizontalScrollBarPolicy ( Qt : : ScrollBarAlwaysOff ) ; //setHorizontalScrollBarPolicy( scrollBarMode );
setVerticalScrollBarPolicy ( scrollBarMode ) ;
}
@ -2015,7 +2016,7 @@ void PageView::keyPressEvent( QKeyEvent * e )
// move/scroll page by using keys
switch ( e - > key ( ) )
{
case Qt : : Key_J :
case Qt : : Key_K :
case Qt : : Key_Down :
slotScrollDown ( true /* singleStep */ ) ;
break ;
@ -2024,18 +2025,28 @@ void PageView::keyPressEvent( QKeyEvent * e )
slotScrollDown ( ) ;
break ;
case Qt : : Key_K :
case Qt : : Key_I :
case Qt : : Key_Up :
slotScrollUp ( true /* singleStep */ ) ;
break ;
case Qt : : Key_PageUp :
case Qt : : Key_Backspace :
slotScrollUp ( ) ;
break ;
if ( e - > key ( ) = = Qt : : Key_Down
| | e - > key ( ) = = Qt : : Key_PageDown
| | e - > key ( ) = = Qt : : Key_K )
{
bool singleStep = e - > key ( ) = = Qt : : Key_Down | | e - > key ( ) = = Qt : : Key_K ;
slotScrollDown ( singleStep ) ;
}
else
{
bool singleStep = e - > key ( ) = = Qt : : Key_Up | | e - > key ( ) = = Qt : : Key_I ;
slotScrollUp ( singleStep ) ;
}
break ;
case Qt : : Key_Left :
case Qt : : Key_H :
case Qt : : Key_J :
if ( horizontalScrollBar ( ) - > maximum ( ) = = 0 )
{
//if we cannot scroll we go to the previous page vertically
@ -3405,17 +3416,11 @@ void PageView::wheelEvent( QWheelEvent *e )
vScroll = verticalScrollBar ( ) - > value ( ) ;
e - > accept ( ) ;
if ( ( e - > modifiers ( ) & Qt : : ControlModifier ) = = Qt : : ControlModifier ) {
d - > controlWheelAccumulatedDelta + = delta ;
if ( d - > controlWheelAccumulatedDelta < = - QWheelEvent : : DefaultDeltasPerStep )
{
slotZoomOut ( ) ;
d - > controlWheelAccumulatedDelta = 0 ;
}
else if ( d - > controlWheelAccumulatedDelta > = QWheelEvent : : DefaultDeltasPerStep )
{
slotZoomIn ( ) ;
d - > controlWheelAccumulatedDelta = 0 ;
}
d - > zoomFactor * = exp ( ( double ) delta / 120.0 ) ;
d - > blockPixmapsRequest = true ;
updateZoom ( ZoomRefreshCurrent ) ;
d - > blockPixmapsRequest = false ;
viewport ( ) - > repaint ( ) ;
}
else
{
@ -3880,7 +3885,7 @@ void PageView::selectionStart( const QPoint & pos, const QColor & color, bool /*
void PageView : : scrollPosIntoView ( const QPoint & pos )
{
// this number slows the speed of the page by its value, chosen not to be too fast or too slow, the actual speed is determined from the mouse position, not critical
const int damping = 6 ;
const int damping = 6 ;
if ( pos . x ( ) < horizontalScrollBar ( ) - > value ( ) ) d - > dragScrollVector . setX ( ( pos . x ( ) - horizontalScrollBar ( ) - > value ( ) ) / damping ) ;
else if ( horizontalScrollBar ( ) - > value ( ) + viewport ( ) - > width ( ) < pos . x ( ) ) d - > dragScrollVector . setX ( ( pos . x ( ) - horizontalScrollBar ( ) - > value ( ) - viewport ( ) - > width ( ) ) / damping ) ;
@ -5062,7 +5067,7 @@ void PageView::slotAutoScroll()
// compute delay between timer ticks and scroll amount per tick
int index = abs ( d - > scrollIncrement ) - 1 ; // 0..9
const int scrollDelay [ 10 ] = { 200 , 100 , 50 , 30 , 20 , 30 , 25 , 20 , 30 , 2 0 } ;
const int scrollDelay [ 10 ] = { 100 , 50 , 25 , 15 , 10 , 15 , 12 , 10 , 15 , 1 0 } ;
const int scrollOffset [ 10 ] = { 1 , 1 , 1 , 1 , 1 , 2 , 2 , 2 , 4 , 4 } ;
d - > autoScrollTimer - > start ( scrollDelay [ index ] ) ;
int delta = d - > scrollIncrement > 0 ? scrollOffset [ index ] : - scrollOffset [ index ] ;