@ -2015,7 +2015,7 @@ void PageView::keyPressEvent( QKeyEvent * e )
// move/scroll page by using keys
switch ( e - > key ( ) )
{
case Qt : : Key_J :
case Qt : : Key_I :
case Qt : : Key_Down :
slotScrollDown ( true /* singleStep */ ) ;
break ;
@ -2031,11 +2031,21 @@ void PageView::keyPressEvent( QKeyEvent * e )
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
@ -3880,7 +3890,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 ) ;