|
|
|
|
@ -937,9 +937,12 @@ void PageView::reparseConfig() |
|
|
|
|
PageView::updateSmoothScrollAnimationSpeed(); |
|
|
|
|
|
|
|
|
|
// set the scroll bars policies
|
|
|
|
|
Qt::ScrollBarPolicy scrollBarMode = Okular::Settings::showScrollBars() ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff; |
|
|
|
|
if (horizontalScrollBarPolicy() != scrollBarMode) { |
|
|
|
|
setHorizontalScrollBarPolicy(scrollBarMode); |
|
|
|
|
setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); |
|
|
|
|
Qt::ScrollBarPolicy scrollBarMode = Okular::Settings::showScrollBars() ? |
|
|
|
|
Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff; |
|
|
|
|
if ( horizontalScrollBarPolicy() != scrollBarMode ) |
|
|
|
|
{ |
|
|
|
|
setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); //setHorizontalScrollBarPolicy( scrollBarMode );
|
|
|
|
|
setVerticalScrollBarPolicy( scrollBarMode ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -2045,19 +2048,20 @@ void PageView::keyPressEvent(QKeyEvent *e) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
// move/scroll page by using keys
|
|
|
|
|
switch (e->key()) { |
|
|
|
|
case Qt::Key_J: |
|
|
|
|
switch ( e->key() ) |
|
|
|
|
{ |
|
|
|
|
case Qt::Key_K: |
|
|
|
|
case Qt::Key_Down: |
|
|
|
|
slotScrollDown(1 /* go down 1 step */); |
|
|
|
|
slotScrollDown( 3 /* go down 1 step */ ); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Qt::Key_PageDown: |
|
|
|
|
slotScrollDown(); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Qt::Key_K: |
|
|
|
|
case Qt::Key_I: |
|
|
|
|
case Qt::Key_Up: |
|
|
|
|
slotScrollUp(1 /* go up 1 step */); |
|
|
|
|
slotScrollUp( 3 /* go up 1 step */ ); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case Qt::Key_PageUp: |
|
|
|
|
@ -2066,7 +2070,7 @@ void PageView::keyPressEvent(QKeyEvent *e) |
|
|
|
|
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
|
|
|
|
|
int next_page = d->document->currentPage() - viewColumns(); |
|
|
|
|
@ -3184,15 +3188,14 @@ void PageView::wheelEvent(QWheelEvent *e) |
|
|
|
|
int delta = e->angleDelta().y(), 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 { |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
d->controlWheelAccumulatedDelta = 0; |
|
|
|
|
|
|
|
|
|
if (delta <= -QWheelEvent::DefaultDeltasPerStep && !getContinuousMode() && vScroll == verticalScrollBar()->maximum()) { |
|
|
|
|
@ -4684,7 +4687,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, 20}; |
|
|
|
|
const int scrollDelay[10] = { 100, 50, 25, 15, 10, 15, 12, 10, 15, 10 }; |
|
|
|
|
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 ]; |
|
|
|
|
|