Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix KisAnimTimelineFramesModel data changed ranges

Carsten Hartenfels3fe55c925cd4
diff --git a/plugins/dockers/animation/KisAnimTimelineFramesModel.cpp b/plugins/dockers/animation/KisAnimTimelineFramesModel.cpp
index 8d37e2afbb..77deb9612f 100644
--- a/plugins/dockers/animation/KisAnimTimelineFramesModel.cpp
+++ b/plugins/dockers/animation/KisAnimTimelineFramesModel.cpp
@@ -334,7 +334,7 @@ void KisAnimTimelineFramesModel::processUpdateQueue()
if (row >= 0) {
Q_EMIT headerDataChanged (Qt::Vertical, row, row);
- Q_EMIT dataChanged(this->index(row, 0), this->index(row, columnCount() - 1));
+ emitRowDataChanged(row);
}
}
m_d->updateQueue.clear();
@@ -446,8 +446,8 @@ bool KisAnimTimelineFramesModel::setData(const QModelIndex &index, const QVarian
int prevLayer = m_d->activeLayerIndex;
m_d->activeLayerIndex = index.row();
- Q_EMIT dataChanged(this->index(prevLayer, 0), this->index(prevLayer, columnCount() - 1));
- Q_EMIT dataChanged(this->index(m_d->activeLayerIndex, 0), this->index(m_d->activeLayerIndex, columnCount() - 1));
+ emitRowDataChanged(prevLayer);
+ emitRowDataChanged(m_d->activeLayerIndex);
Q_EMIT headerDataChanged(Qt::Vertical, prevLayer, prevLayer);
Q_EMIT headerDataChanged(Qt::Vertical, m_d->activeLayerIndex, m_d->activeLayerIndex);
@@ -1157,3 +1157,12 @@ void KisAnimTimelineFramesModel::setActiveLayerSelectedTimes(const QSet<int> &ti
m_d->image->animationInterface()->setActiveLayerSelectedTimes(times);
}
+
+void KisAnimTimelineFramesModel::emitRowDataChanged(int row)
+{
+ int rows = rowCount();
+ int cols = columnCount();
+ if (row >= 0 && row < rows && cols > 0) {
+ Q_EMIT dataChanged(index(row, 0), index(row, cols - 1));
+ }
+}
diff --git a/plugins/dockers/animation/KisAnimTimelineFramesModel.h b/plugins/dockers/animation/KisAnimTimelineFramesModel.h
index 92950c380e..d4b485bc97 100644
--- a/plugins/dockers/animation/KisAnimTimelineFramesModel.h
+++ b/plugins/dockers/animation/KisAnimTimelineFramesModel.h
@@ -161,6 +161,8 @@ Q_SIGNALS:
void sigFullClipRangeChanged();
private:
+ void emitRowDataChanged(int row);
+
struct Private;
const QScopedPointer<Private> m_d;
};