mirror of
https://github.com/leozide/leocad
synced 2025-01-18 22:26:44 +01:00
Use text color for the flexible icon.
This commit is contained in:
parent
e9040c8332
commit
2a019412e1
1 changed files with 17 additions and 0 deletions
|
@ -440,6 +440,23 @@ void lcPartSelectionListModel::DrawPreview(int InfoIndex)
|
|||
{
|
||||
QPainter Painter(&Image);
|
||||
QImage Icon = QImage(":/resources/flexible.png");
|
||||
uchar* ImageBits = Icon.bits();
|
||||
QRgb TextColor = mListView->palette().color(QPalette::WindowText).rgba();
|
||||
int Red = qRed(TextColor);
|
||||
int Green = qGreen(TextColor);
|
||||
int Blue = qBlue(TextColor);
|
||||
|
||||
for (int y = 0; y < Icon.height(); y++)
|
||||
{
|
||||
for (int x = 0; x < Icon.width(); x++)
|
||||
{
|
||||
QRgb& Pixel = ((QRgb*)ImageBits)[x];
|
||||
Pixel = qRgba(Red, Green, Blue, qAlpha(Pixel));
|
||||
}
|
||||
|
||||
ImageBits += Icon.bytesPerLine();
|
||||
}
|
||||
|
||||
Painter.drawImage(QPoint(0, 0), Icon);
|
||||
Painter.end();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue