Commit 62f8c3b3 authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Sync layer scroll-visibility in the timeline when using PgUp and PgDown

BUG:373316
Fixes T4837
parent aa2f46dd
......@@ -352,6 +352,7 @@ bool TimelineFramesModel::setData(const QModelIndex &index, const QVariant &valu
KIS_ASSERT_RECOVER(dummy) { return true; }
emit requestCurrentNodeChanged(dummy->node());
emit sigEnsureRowVisible(m_d->activeLayerIndex);
}
break;
}
......
......@@ -112,6 +112,7 @@ public Q_SLOTS:
Q_SIGNALS:
void requestCurrentNodeChanged(KisNodeSP node);
void sigInfiniteTimelineUpdateNeeded();
void sigEnsureRowVisible(int row);
private:
struct Private;
......
......@@ -273,6 +273,8 @@ void TimelineFramesView::setModel(QAbstractItemModel *model)
connect(selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
&m_d->selectionChangedCompressor, SLOT(start()));
connect(m_d->model, SIGNAL(sigEnsureRowVisible(int)), SLOT(slotEnsureRowVisible(int)));
}
void TimelineFramesView::setFramesPerSecond(int fps)
......@@ -415,6 +417,15 @@ void TimelineFramesView::slotReselectCurrentIndex()
currentChanged(index, index);
}
void TimelineFramesView::slotEnsureRowVisible(int row)
{
QModelIndex index = currentIndex();
if (!index.isValid() || row < 0) return;
index = m_d->model->index(row, index.column());
scrollTo(index);
}
void TimelineFramesView::slotDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
{
if (m_d->model->isPlaybackActive()) return;
......
......@@ -70,6 +70,8 @@ private Q_SLOTS:
void slotZoomButtonChanged(qreal value);
void slotColorLabelChanged(int);
void slotEnsureRowVisible(int row);
private:
void setFramesPerSecond(int fps);
......
......@@ -240,16 +240,11 @@ void TimelineLayersHeader::mousePressEvent(QMouseEvent *e)
emit sigRequestContextMenu(e->globalPos());
return;
} else if (e->button() == Qt::LeftButton) {
slotActivateSection(logical);
model()->setHeaderData(logical, orientation(), true, TimelineFramesModel::ActiveLayerRole);
}
}
QHeaderView::mousePressEvent(e);
}
void TimelineLayersHeader::slotActivateSection(int logicalIndex)
{
model()->setHeaderData(logicalIndex, orientation(), true, TimelineFramesModel::ActiveLayerRole);
}
......@@ -37,9 +37,6 @@ protected:
bool viewportEvent(QEvent *e);
void mousePressEvent(QMouseEvent *e);
private Q_SLOTS:
void slotActivateSection(int logicalIndex);
Q_SIGNALS:
void sigRequestContextMenu(const QPoint &pos);
......
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