[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [krita/rempt/impex-refactoring] plugins/dockers/animation: Sync layer scroll-visibility in the timel
From:       Dmitry Kazakov <dimula73 () gmail ! com>
Date:       2016-12-09 15:20:43
Message-ID: E1cFMyZ-0004Dm-41 () code ! kde ! org
[Download RAW message or body]

Git commit 62f8c3b3b2937ac24e2ca7d40cf425985d406960 by Dmitry Kazakov.
Committed on 09/12/2016 at 15:20.
Pushed by dkazakov into branch 'rempt/impex-refactoring'.

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

BUG:373316
Fixes T4837

M  +1    -0    plugins/dockers/animation/timeline_frames_model.cpp
M  +1    -0    plugins/dockers/animation/timeline_frames_model.h
M  +11   -0    plugins/dockers/animation/timeline_frames_view.cpp
M  +2    -0    plugins/dockers/animation/timeline_frames_view.h
M  +1    -6    plugins/dockers/animation/timeline_layers_header.cpp
M  +0    -3    plugins/dockers/animation/timeline_layers_header.h

https://commits.kde.org/krita/62f8c3b3b2937ac24e2ca7d40cf425985d406960

diff --git a/plugins/dockers/animation/timeline_frames_model.cpp \
b/plugins/dockers/animation/timeline_frames_model.cpp index daed88e26f7..dc5d4ef97ea \
                100644
--- a/plugins/dockers/animation/timeline_frames_model.cpp
+++ b/plugins/dockers/animation/timeline_frames_model.cpp
@@ -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;
     }
diff --git a/plugins/dockers/animation/timeline_frames_model.h \
b/plugins/dockers/animation/timeline_frames_model.h index 3c147ad8a87..67a74a5be52 \
                100644
--- a/plugins/dockers/animation/timeline_frames_model.h
+++ b/plugins/dockers/animation/timeline_frames_model.h
@@ -112,6 +112,7 @@ public Q_SLOTS:
 Q_SIGNALS:
     void requestCurrentNodeChanged(KisNodeSP node);
     void sigInfiniteTimelineUpdateNeeded();
+    void sigEnsureRowVisible(int row);
 
 private:
     struct Private;
diff --git a/plugins/dockers/animation/timeline_frames_view.cpp \
b/plugins/dockers/animation/timeline_frames_view.cpp index e0c836ad6e3..cf9dcbf308a \
                100644
--- a/plugins/dockers/animation/timeline_frames_view.cpp
+++ b/plugins/dockers/animation/timeline_frames_view.cpp
@@ -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;
diff --git a/plugins/dockers/animation/timeline_frames_view.h \
b/plugins/dockers/animation/timeline_frames_view.h index 1f395216146..4a77116edc3 \
                100644
--- a/plugins/dockers/animation/timeline_frames_view.h
+++ b/plugins/dockers/animation/timeline_frames_view.h
@@ -70,6 +70,8 @@ private Q_SLOTS:
     void slotZoomButtonChanged(qreal value);
 
     void slotColorLabelChanged(int);
+    void slotEnsureRowVisible(int row);
+
 
 private:
     void setFramesPerSecond(int fps);
diff --git a/plugins/dockers/animation/timeline_layers_header.cpp \
b/plugins/dockers/animation/timeline_layers_header.cpp index ba1a85787b0..c789298bb15 \
                100644
--- a/plugins/dockers/animation/timeline_layers_header.cpp
+++ b/plugins/dockers/animation/timeline_layers_header.cpp
@@ -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);
-}
-
 
diff --git a/plugins/dockers/animation/timeline_layers_header.h \
b/plugins/dockers/animation/timeline_layers_header.h index 1e8869cb87c..89b22dad10a \
                100644
--- a/plugins/dockers/animation/timeline_layers_header.h
+++ b/plugins/dockers/animation/timeline_layers_header.h
@@ -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);
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic