mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-20 03:46:11 +00:00
Get color for optimization (#1404)
* small optimization function getColorFor
This commit is contained in:
parent
41af189312
commit
d0540d7655
@ -14,20 +14,17 @@
|
|||||||
|
|
||||||
const int NewFileDialog::MaxRecentFiles;
|
const int NewFileDialog::MaxRecentFiles;
|
||||||
|
|
||||||
static QColor getColorFor(const QString &str, int pos)
|
static QColor getColorFor(int pos)
|
||||||
{
|
{
|
||||||
Q_UNUSED(str);
|
static const QList<QColor> colors = {
|
||||||
|
QColor(29, 188, 156), // Turquoise
|
||||||
QList<QColor> Colors;
|
QColor(52, 152, 219), // Blue
|
||||||
Colors << QColor(29, 188, 156); // Turquoise
|
QColor(155, 89, 182), // Violet
|
||||||
Colors << QColor(52, 152, 219); // Blue
|
QColor(52, 73, 94), // Grey
|
||||||
Colors << QColor(155, 89, 182); // Violet
|
QColor(231, 76, 60), // Red
|
||||||
Colors << QColor(52, 73, 94); // Grey
|
QColor(243, 156, 17) // Orange
|
||||||
Colors << QColor(231, 76, 60); // Red
|
};
|
||||||
Colors << QColor(243, 156, 17); // Orange
|
return colors[pos % 6];
|
||||||
|
|
||||||
return Colors[pos % 6];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static QIcon getIconFor(const QString &str, int pos)
|
static QIcon getIconFor(const QString &str, int pos)
|
||||||
@ -42,7 +39,7 @@ static QIcon getIconFor(const QString &str, int pos)
|
|||||||
QPainter pixPaint(&pixmap);
|
QPainter pixPaint(&pixmap);
|
||||||
pixPaint.setPen(Qt::NoPen);
|
pixPaint.setPen(Qt::NoPen);
|
||||||
pixPaint.setRenderHint(QPainter::Antialiasing);
|
pixPaint.setRenderHint(QPainter::Antialiasing);
|
||||||
pixPaint.setBrush(QBrush(QBrush(getColorFor(str, pos))));
|
pixPaint.setBrush(getColorFor(pos));
|
||||||
pixPaint.drawEllipse(1, 1, w - 2, h - 2);
|
pixPaint.drawEllipse(1, 1, w - 2, h - 2);
|
||||||
pixPaint.setPen(Qt::white);
|
pixPaint.setPen(Qt::white);
|
||||||
pixPaint.setFont(QFont("Verdana", 24, 1));
|
pixPaint.setFont(QFont("Verdana", 24, 1));
|
||||||
|
Loading…
Reference in New Issue
Block a user