Added color icons to the timeline.

This commit is contained in:
leo 2015-04-15 18:49:17 +00:00
parent 81fc732158
commit 4ad0cfecf2
2 changed files with 20 additions and 0 deletions

View file

@ -151,6 +151,25 @@ void lcTimelineWidget::Update(bool Clear)
PieceItem->setData(0, Qt::UserRole, qVariantFromValue<uintptr_t>((uintptr_t)Piece));
StepItem->insertChild(PieceItemIndex, PieceItem);
mItems[Piece] = PieceItem;
int ColorIndex = Piece->mColorIndex;
if (!mIcons.contains(ColorIndex))
{
int Size = rowHeight(indexFromItem(PieceItem));
QImage Image(Size, Size, QImage::Format_ARGB32);
Image.fill(QColor::fromRgbF(1.0, 1.0, 1.0, 0.0));
float* Color = gColorList[ColorIndex].Value;
QPainter Painter(&Image);
Painter.setPen(Qt::NoPen);
Painter.setBrush(QColor::fromRgbF(Color[0], Color[1], Color[2]));
Painter.drawEllipse(QPoint(Size / 2, Size / 2), Size / 2, Size / 2);
mIcons[ColorIndex] = QIcon(QPixmap::fromImage(Image));
}
PieceItem->setIcon(0, mIcons[ColorIndex]);
}
else
{

View file

@ -21,6 +21,7 @@ public slots:
protected:
virtual void dropEvent(QDropEvent* Event);
QMap<int, QIcon> mIcons;
QMap<lcPiece*, QTreeWidgetItem*> mItems;
bool mIgnoreUpdates;
};