mirror of
https://github.com/leozide/leocad
synced 2025-01-28 19:58:12 +01:00
Added color icons to the timeline.
This commit is contained in:
parent
81fc732158
commit
4ad0cfecf2
2 changed files with 20 additions and 0 deletions
|
@ -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
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@ public slots:
|
|||
protected:
|
||||
virtual void dropEvent(QDropEvent* Event);
|
||||
|
||||
QMap<int, QIcon> mIcons;
|
||||
QMap<lcPiece*, QTreeWidgetItem*> mItems;
|
||||
bool mIgnoreUpdates;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue