Changeset View
Changeset View
Standalone View
Standalone View
src/view/kateviewinternal.cpp
Show First 20 Lines • Show All 3371 Lines • ▼ Show 20 Line(s) | 3366 | if (m_zoomEventFilter->detectZoomingEvent(e)) { | |||
---|---|---|---|---|---|
3372 | 3372 | | |||
3373 | // accept always and be done for zooming | 3373 | // accept always and be done for zooming | ||
3374 | e->accept(); | 3374 | e->accept(); | ||
3375 | return; | 3375 | return; | ||
3376 | } | 3376 | } | ||
3377 | 3377 | | |||
3378 | // handle vertical scrolling via the scrollbar | 3378 | // handle vertical scrolling via the scrollbar | ||
3379 | if (e->orientation() == Qt::Vertical) { | 3379 | if (e->orientation() == Qt::Vertical) { | ||
3380 | QWheelEvent copy = *e; | 3380 | // compute distance | ||
3381 | QApplication::sendEvent(m_lineScroll, ©); | 3381 | auto sign = m_lineScroll->invertedControls() ? -1 : 1; | ||
3382 | if (copy.isAccepted()) { | 3382 | auto offset = sign * qreal(e->angleDelta().y()) / 120.0; | ||
3383 | e->accept(); | 3383 | if ( e->modifiers() & Qt::ShiftModifier ) { | ||
3384 | const auto pageStep = m_lineScroll->pageStep(); | ||||
3385 | offset = qBound(-pageStep, int(offset * pageStep), pageStep); | ||||
3386 | } else { | ||||
3387 | offset *= QApplication::wheelScrollLines(); | ||||
3384 | } | 3388 | } | ||
3389 | | ||||
3390 | // handle accumulation | ||||
3391 | m_accumulatedScroll += offset - int(offset); | ||||
3392 | const auto extraAccumulated = int(m_accumulatedScroll); | ||||
3393 | m_accumulatedScroll -= extraAccumulated; | ||||
3394 | | ||||
3395 | // do scroll | ||||
3396 | scrollViewLines(int(offset) + extraAccumulated); | ||||
3397 | e->accept(); | ||||
3385 | } | 3398 | } | ||
3386 | 3399 | | |||
3387 | // handle horizontal scrolling via the scrollbar | 3400 | // handle horizontal scrolling via the scrollbar | ||
3388 | if (e->orientation() == Qt::Horizontal) { | 3401 | if (e->orientation() == Qt::Horizontal) { | ||
3389 | // if we have dyn word wrap, we should ignore the scroll events | 3402 | // if we have dyn word wrap, we should ignore the scroll events | ||
3390 | if (m_view->dynWordWrap()) { | 3403 | if (m_view->dynWordWrap()) { | ||
3391 | e->accept(); | 3404 | e->accept(); | ||
3392 | return; | 3405 | return; | ||
▲ Show 20 Lines • Show All 454 Lines • Show Last 20 Lines |