diff --git a/plugins/dockers/animation/timeline_frames_item_delegate.cpp b/plugins/dockers/animation/timeline_frames_item_delegate.cpp --- a/plugins/dockers/animation/timeline_frames_item_delegate.cpp +++ b/plugins/dockers/animation/timeline_frames_item_delegate.cpp @@ -108,7 +108,7 @@ bool active = index.data(TimelineFramesModel::ActiveLayerRole).toBool(); bool present = index.data(TimelineFramesModel::FrameExistsRole).toBool(); bool editable = index.data(TimelineFramesModel::FrameEditableRole).toBool(); - QVariant colorLabel = index.data(TimelineFramesModel::ColorLabel); + QVariant colorLabel = index.data(TimelineFramesModel::FrameColorLabelIndexRole); QColor color = colorLabel.isValid() ? labelColors.at(colorLabel.toInt()) : TimelineColorScheme::instance()->frameColor(present, active); diff --git a/plugins/dockers/animation/timeline_frames_model.h b/plugins/dockers/animation/timeline_frames_model.h --- a/plugins/dockers/animation/timeline_frames_model.h +++ b/plugins/dockers/animation/timeline_frames_model.h @@ -84,7 +84,7 @@ TimelinePropertiesRole, OtherLayersRole, LayerUsedInTimelineRole, - ColorLabel + FrameColorLabelIndexRole }; // metatype is added by the original implementation diff --git a/plugins/dockers/animation/timeline_frames_model.cpp b/plugins/dockers/animation/timeline_frames_model.cpp --- a/plugins/dockers/animation/timeline_frames_model.cpp +++ b/plugins/dockers/animation/timeline_frames_model.cpp @@ -46,6 +46,10 @@ #include "kis_projection_leaf.h" #include "kis_time_range.h" +#include "kis_node_view_color_scheme.h" +#include "krita_utils.h" +#include + struct TimelineFramesModel::Private { Private() @@ -134,6 +138,12 @@ frame->setColorLabel(color); } + int layerColorLabel(int row) const { + KisNodeDummy *dummy = converter->dummyFromRow(row); + if (!dummy) return -1; + return dummy->node()->colorLabelIndex(); + } + QVariant layerProperties(int row) const { KisNodeDummy *dummy = converter->dummyFromRow(row); if (!dummy) return QVariant(); @@ -321,7 +331,7 @@ case SpecialKeyframeExists: { return m_d->specialKeyframeExists(index.row(), index.column()); } - case ColorLabel: { + case FrameColorLabelIndexRole: { int label = m_d->frameColorLabel(index.row(), index.column()); return label > 0 ? label : QVariant(); } @@ -362,7 +372,7 @@ } break; } - case ColorLabel: { + case FrameColorLabelIndexRole: { m_d->setFrameColorLabel(index.row(), index.column(), value.toInt()); } break; @@ -428,6 +438,18 @@ if (!dummy) return QVariant(); return dummy->node()->useInTimeline(); } + case Qt::BackgroundRole: { + int label = m_d->layerColorLabel(section); + if (label > 0) { + KisNodeViewColorScheme scm; + QColor color = scm.colorLabel(label); + QPalette pal = qApp->palette(); + color = KritaUtils::blendColors(color, pal.color(QPalette::Button), 0.3); + return QBrush(color); + } else { + return QVariant(); + } + } } } diff --git a/plugins/dockers/animation/timeline_frames_view.cpp b/plugins/dockers/animation/timeline_frames_view.cpp --- a/plugins/dockers/animation/timeline_frames_view.cpp +++ b/plugins/dockers/animation/timeline_frames_view.cpp @@ -387,7 +387,7 @@ void TimelineFramesView::slotColorLabelChanged(int label) { Q_FOREACH(QModelIndex index, selectedIndexes()) { - m_d->model->setData(index, label, TimelineFramesModel::ColorLabel); + m_d->model->setData(index, label, TimelineFramesModel::FrameColorLabelIndexRole); } KisImageConfig config; @@ -861,7 +861,7 @@ { KisSignalsBlocker b(m_d->colorSelector); - QVariant colorLabel = index.data(TimelineFramesModel::ColorLabel); + QVariant colorLabel = index.data(TimelineFramesModel::FrameColorLabelIndexRole); int labelIndex = colorLabel.isValid() ? colorLabel.toInt() : 0; m_d->colorSelector->setCurrentIndex(labelIndex); } @@ -875,7 +875,7 @@ bool haveFrames = false; Q_FOREACH(QModelIndex index, selectedIndexes()) { haveFrames |= index.data(TimelineFramesModel::FrameExistsRole).toBool(); - QVariant colorLabel = index.data(TimelineFramesModel::ColorLabel); + QVariant colorLabel = index.data(TimelineFramesModel::FrameColorLabelIndexRole); if (colorLabel.isValid()) { if (labelIndex == 0) { labelIndex = colorLabel.toInt(); diff --git a/plugins/dockers/animation/timeline_layers_header.cpp b/plugins/dockers/animation/timeline_layers_header.cpp --- a/plugins/dockers/animation/timeline_layers_header.cpp +++ b/plugins/dockers/animation/timeline_layers_header.cpp @@ -136,7 +136,7 @@ QVector lines; lines << QLine(x0, y0 + lineWidth / 2, x1, y0 + lineWidth / 2); - lines << QLine(x0, y1 - lineWidth / 2, x1, y1 - lineWidth / 2); + lines << QLine(x0, y1 - lineWidth / 2, x1, y1 - lineWidth / 2); painter->drawLines(lines);