Zooming in these widgets using CTRL+two-finger scrolling was almost

impossible, i.e. tiny and precise movements were necessary to get to a
desired scroll level. Patch by Thomas Mitterfellner

BUG: 406985
FIXED-IN: 19.04.1
Differential Revision: https://phabricator.kde.org/D20873
parent 1da40dbc
Pipeline #3041 passed with stage
in 18 minutes and 41 seconds
......@@ -762,6 +762,7 @@ Bin::Bin(std::shared_ptr<ProjectItemModel> model, QWidget *parent)
m_infoMessage->hide();
connect(this, &Bin::requesteInvalidRemoval, this, &Bin::slotQueryRemoval);
connect(this, SIGNAL(displayBinMessage(QString, KMessageWidget::MessageType)), this, SLOT(doDisplayMessage(QString, KMessageWidget::MessageType)));
wheelAccumulatedDelta = 0;
}
Bin::~Bin()
......@@ -837,7 +838,10 @@ bool Bin::eventFilter(QObject *obj, QEvent *event)
if (event->type() == QEvent::Wheel) {
auto *e = static_cast<QWheelEvent *>(event);
if ((e != nullptr) && e->modifiers() == Qt::ControlModifier) {
slotZoomView(e->delta() > 0);
wheelAccumulatedDelta += e->delta();
if (abs(wheelAccumulatedDelta) >= QWheelEvent::DefaultDeltasPerStep) {
slotZoomView(wheelAccumulatedDelta > 0);
}
// emit zoomView(e->delta() > 0);
return true;
}
......@@ -881,6 +885,7 @@ void Bin::slotSaveHeaders()
void Bin::slotZoomView(bool zoomIn)
{
wheelAccumulatedDelta = 0;
if (m_itemModel->rowCount() == 0) {
// Don't zoom on empty bin
return;
......
......@@ -441,6 +441,7 @@ private:
void showTitleWidget(const std::shared_ptr<ProjectClip> &clip);
void showSlideshowWidget(const std::shared_ptr<ProjectClip> &clip);
void processAudioThumbs();
int wheelAccumulatedDelta;
signals:
void itemUpdated(std::shared_ptr<AbstractProjectItem>);
......
......@@ -74,11 +74,14 @@ Rectangle {
timeline.triggerAction('monitor_seek_snap_forward')
}
} else if (wheel.modifiers & Qt.ControlModifier) {
root.wheelAccumulatedDelta += wheel.angleDelta.y;
// Zoom
if (wheel.angleDelta.y > 0) {
if (root.wheelAccumulatedDelta >= defaultDeltasPerStep) {
root.zoomIn(true);
} else {
root.wheelAccumulatedDelta = 0;
} else if (root.wheelAccumulatedDelta <= -defaultDeltasPerStep) {
root.zoomOut(true);
root.wheelAccumulatedDelta = 0;
}
} else if (wheel.modifiers & Qt.ShiftModifier) {
// Vertical scroll
......@@ -231,6 +234,8 @@ Rectangle {
property int copiedClip: -1
property int zoomOnMouse: -1
property int viewActiveTrack: timeline.activeTrack
property int wheelAccumulatedDelta: 0
readonly property int defaultDeltasPerStep: 120
//onCurrentTrackChanged: timeline.selection = []
onTimeScaleChanged: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment