Interface theme and theme features refactoring (#1598)

* init commit

* use hex

* delete obsolete code

* alpha channel feature update

* enhance pattern painting

* remove useless code

* add comment
This commit is contained in:
optizone 2019-06-12 20:46:07 +03:00 committed by Itay Cohen
parent a3657f913b
commit 228d3a454a
8 changed files with 160 additions and 184 deletions

View File

@ -5,6 +5,7 @@
#include <QColor>
#include <QJsonArray>
#include <QStandardPaths>
#include "common/Configuration.h"
const QStringList ColorThemeWorker::cutterSpecificOptions = {
@ -160,15 +161,26 @@ bool ColorThemeWorker::isThemeExist(const QString &name) const
QJsonDocument ColorThemeWorker::getTheme(const QString& themeName) const
{
int r, g, b, a;
QJsonObject theme;
QVariantMap theme;
QString curr = Config()->getColorTheme();
if (themeName != curr) {
Core()->cmd(QString("eco %1").arg(themeName));
theme = Core()->cmdj("ecj").object();
theme = Core()->cmdj("ecj").object().toVariantMap();
Core()->cmd(QString("eco %1").arg(curr));
} else {
theme = Core()->cmdj("ecj").object();
theme = Core()->cmdj("ecj").object().toVariantMap();
}
for (auto it = theme.begin(); it != theme.end(); it++) {
auto arr = it.value().toList();
QColor(arr[0].toInt(), arr[1].toInt(), arr[2].toInt()).getRgb(&r, &g, &b, &a);
theme[it.key()] = QJsonArray({r, g, b, a});
}
for (auto& it : cutterSpecificOptions) {
Configuration::cutterOptionColors[it][Configuration::relevantThemes[themeName]].getRgb(&r, &g, &b, &a);
theme.insert(it, QJsonArray{r, g, b, a});
}
if (isCustomTheme(themeName)) {
@ -185,27 +197,13 @@ QJsonDocument ColorThemeWorker::getTheme(const QString& themeName) const
QColor(sl[2]).getRgb(&r, &g, &b, &a);
theme.insert(sl[1], QJsonArray({r, g, b, a}));
}
for (auto &it : cutterSpecificOptions) {
if (!theme.contains(it)) {
mergeColors(Config()->getColor(it),
Config()->getColor("gui.background")).getRgb(&r, &g, &b, &a);
Config()->getColor(it).getRgb(&r, &g, &b, &a);
theme.insert(it, QJsonArray({r, g, b, a}));
}
}
} else {
for (auto &it : cutterSpecificOptions) {
mergeColors(Config()->getColor(it),
Config()->getColor("gui.background")).getRgb(&r, &g, &b, &a);
Config()->getColor(it).getRgb(&r, &g, &b, &a);
theme.insert(it, QJsonArray({r, g, b, a}));
}
}
for (auto &key : radare2UnusedOptions) {
theme.remove(key);
}
return QJsonDocument(theme);
return QJsonDocument(QJsonObject::fromVariantMap(theme));
}
QString ColorThemeWorker::deleteTheme(const QString &themeName) const

View File

@ -9,10 +9,77 @@
#include "common/ColorThemeWorker.h"
const QList<CutterInterfaceTheme> kCutterInterfaceThemesList = {
{ "Native", static_cast<ColorFlags>(LightFlag | DarkFlag) },
{ "Dark", DarkFlag },
{ "Light", LightFlag }
/* Map with names of themes associated with its color palette
* (Dark or Light), so for dark interface themes will be shown only Dark color themes
* and for light - only light ones.
*/
const QHash<QString, ColorFlags> Configuration::relevantThemes = {
{ "ayu", DarkFlag },
{ "consonance", DarkFlag },
{ "darkda", DarkFlag },
{ "onedark", DarkFlag },
{ "solarized", DarkFlag },
{ "zenburn", DarkFlag },
{ "cutter", LightFlag },
{ "dark", LightFlag },
{ "matrix", LightFlag },
{ "tango", LightFlag },
{ "white", LightFlag }
};
const QHash<QString, QHash<ColorFlags, QColor>> Configuration::cutterOptionColors = {
{ "gui.cflow", { { DarkFlag, QColor(0xff, 0xff, 0xff) },
{ LightFlag, QColor(0x00, 0x00, 0x00) }} },
{ "gui.dataoffset", { { DarkFlag, QColor(0xff, 0xff, 0xff) },
{ LightFlag, QColor(0x00, 0x00, 0x00) }} },
{ "gui.imports", { { DarkFlag, QColor(0x32, 0x8c, 0xff) },
{ LightFlag, QColor(0x32, 0x8c, 0xff) }} },
{ "gui.item_invalid", { { DarkFlag, QColor(0x9b, 0x9b, 0x9b) },
{ LightFlag, QColor(0x9b, 0x9b, 0x9b) }} },
{ "gui.main", { { DarkFlag, QColor(0x00, 0x80, 0x00) },
{ LightFlag, QColor(0x00, 0x80, 0x00) }} },
{ "gui.item_unsafe", { { DarkFlag, QColor(0xff, 0x81, 0x7b) },
{ LightFlag, QColor(0xff, 0x81, 0x7b) }} },
{ "gui.navbar.seek", { { DarkFlag, QColor(0xe9, 0x56, 0x56) },
{ LightFlag, QColor(0xff, 0x00, 0x00) }} },
{ "gui.navbar.pc", { { DarkFlag, QColor(0x42, 0xee, 0xf4) },
{ LightFlag, QColor(0x42, 0xee, 0xf4) }} },
{ "gui.navbar.code", { { DarkFlag, QColor(0x82, 0xc8, 0x6f) },
{ LightFlag, QColor(0x68, 0xe5, 0x45) }} },
{ "gui.navbar.str", { { DarkFlag, QColor(0x6f, 0x86, 0xd8) },
{ LightFlag, QColor(0x45, 0x68, 0xe5) }} },
{ "gui.navbar.sym", { { DarkFlag, QColor(0xdd, 0xa3, 0x68) },
{ LightFlag, QColor(0xe5, 0x96, 0x45) }} },
{ "gui.navbar.empty", { { DarkFlag, QColor(0x64, 0x64, 0x64) },
{ LightFlag, QColor(0xdc, 0xec, 0xf5) }} },
{ "gui.breakpoint_background", { { DarkFlag, QColor(0x8c, 0x4c, 0x4c) },
{ LightFlag, QColor(0xe9, 0x8f, 0x8f) }} },
{ "gui.overview.node", { { DarkFlag, QColor(0x64, 0x64, 0x64) },
{ LightFlag, QColor(0xf5, 0xfa, 0xff) }} },
{ "gui.tooltip.background", { { DarkFlag, QColor(0x2a, 0x2c, 0x2e) },
{ LightFlag, QColor(0xfa, 0xfc, 0xfe) }} },
{ "gui.tooltip.foreground", { { DarkFlag, QColor(0xfa, 0xfc, 0xfe) },
{ LightFlag, QColor(0x2a, 0x2c, 0x2e) }} },
{ "gui.border", { { DarkFlag, QColor(0x64, 0x64, 0x64) },
{ LightFlag, QColor(0x91, 0xc8, 0xfa) }} },
{ "gui.background", { { DarkFlag, QColor(0x25, 0x28, 0x2b) },
{ LightFlag, QColor(0xff, 0xff, 0xff) }} },
{ "gui.alt_background", { { DarkFlag, QColor(0x1c, 0x1f, 0x24) },
{ LightFlag, QColor(0xf5, 0xfa, 0xff) }} },
{ "gui.disass_selected", { { DarkFlag, QColor(0x1f, 0x22, 0x28) },
{ LightFlag, QColor(0xff, 0xff, 0xff) }} },
{ "lineHighlight", { { DarkFlag, QColor(0x15, 0x1d, 0x1d, 0x96) },
{ LightFlag, QColor(0xd2, 0xd2, 0xff, 0x96) }} },
{ "wordHighlight", { { DarkFlag, QColor(0x34, 0x3a, 0x47, 0xff) },
{ LightFlag, QColor(0xb3, 0x77, 0xd6, 0x3c) }} },
{ "highlightPC", { { DarkFlag, QColor(0x57, 0x1a, 0x07) },
{ LightFlag, QColor(0xd6, 0xff, 0xd2) }} },
{ "gui.overview.fill", { { DarkFlag, QColor(0xff, 0xff, 0xff, 0x28) },
{ LightFlag, QColor(0xaf, 0xd9, 0xea, 0x41) }} },
{ "gui.overview.border", { { DarkFlag, QColor(0x63, 0xda, 0xe8, 0x32) },
{ LightFlag, QColor(0x63, 0xda, 0xe8, 0x32) }} },
{ "gui.navbar.err", { { DarkFlag, QColor(0x03, 0xaa, 0xf5) },
{ LightFlag, QColor(0x03, 0xaa, 0xf5) }} }
};
Configuration *Configuration::mPtr = nullptr;
@ -191,13 +258,17 @@ bool Configuration::windowColorIsDark()
} else if (currentThemeColorFlags == ColorFlags::DarkFlag) {
return true;
}
return nativeWindowIsDark();
}
bool Configuration::nativeWindowIsDark()
{
const QPalette &palette = qApp->palette();
auto windowColor = palette.color(QPalette::Window).toRgb();
return (windowColor.red() + windowColor.green() + windowColor.blue()) < 382;
}
void Configuration::loadBaseThemeNative()
void Configuration::loadNativeStylesheet()
{
/* Load Qt Theme */
QFile f(":native/native.qss");
@ -218,62 +289,12 @@ void Configuration::loadBaseThemeNative()
for (auto widget : qApp->allWidgets()) {
widget->setPalette(nativePalette);
}
/* Colors */
// GUI
setColor("gui.cflow", QColor(0, 0, 0));
// Custom
setColor("gui.imports", QColor(50, 140, 255));
setColor("gui.main", QColor(0, 128, 0));
setColor("gui.navbar.seek", QColor(255, 0, 0));
setColor("gui.navbar.pc", QColor(66, 238, 244));
setColor("gui.navbar.code", QColor(104, 229, 69));
setColor("gui.navbar.str", QColor(69, 104, 229));
setColor("gui.navbar.sym", QColor(229, 150, 69));
setColor("gui.navbar.empty", QColor(100, 100, 100));
setColor("gui.breakpoint_background", QColor(233, 143, 143));
setColor("gui.item_invalid", QColor(155, 155, 155));
setColor("gui.item_unsafe", QColor(255, 129, 123));
setColor("gui.overview.node", QColor(200, 200, 200));
setColor("gui.tooltip.background", QColor(250, 252, 254));
setColor("gui.tooltip.foreground", QColor(42, 44, 46));
}
void Configuration::loadNativeTheme()
{
loadBaseThemeNative();
if (windowColorIsDark()) {
setColor("gui.border", QColor(0, 0, 0));
setColor("gui.background", QColor(30, 30, 30));
setColor("gui.alt_background", QColor(42, 42, 42));
setColor("gui.disass_selected", QColor(35, 35, 35));
setColor("lineHighlight", QColor(255, 255, 255, 15));
setColor("wordHighlight", QColor(20, 20, 20, 255));
setColor("highlightPC", QColor(87, 26, 7));
setColor("gui.tooltip.background", QColor(42, 44, 46));
setColor("gui.tooltip.foreground", QColor(250, 252, 254));
setColor("gui.dataoffset", QColor(255, 255, 255));
setColor("gui.overview.fill", QColor(255, 255, 255, 40));
setColor("gui.overview.border", QColor(99, 218, 232, 50));
} else {
setColor("gui.border", QColor(0, 0, 0));
setColor("gui.background", QColor(255, 255, 255));
setColor("gui.alt_background", QColor(245, 250, 255));
setColor("gui.disass_selected", QColor(255, 255, 255));
setColor("lineHighlight", QColor(210, 210, 255, 150));
setColor("wordHighlight", QColor(179, 119, 214, 60));
setColor("highlightPC", QColor(214, 255, 210));
setColor("gui.dataoffset", QColor(0, 0, 0));
setColor("gui.overview.fill", QColor(175, 217, 234, 65));
setColor("gui.overview.border", QColor(99, 218, 232, 50));
}
}
/**
* @brief Loads the Light theme of Cutter and modify special theme colors
*/
void Configuration::loadLightTheme()
*/
void Configuration::loadLightStylesheet()
{
/* Load Qt Theme */
QFile f(":lightstyle/light.qss");
@ -290,26 +311,9 @@ void Configuration::loadLightTheme()
qApp->setStyleSheet(stylesheet);
}
setColor("gui.border", QColor(145, 200, 250));
setColor("gui.background", QColor(255, 255, 255));
setColor("gui.alt_background", QColor(245, 250, 255));
setColor("gui.disass_selected", QColor(255, 255, 255));
setColor("lineHighlight", QColor(210, 210, 255, 150));
setColor("wordHighlight", QColor(179, 119, 214, 60));
setColor("highlightPC", QColor(214, 255, 210));
setColor("gui.navbar.empty", QColor(220, 236, 245));
setColor("gui.navbar.err", QColor(3, 170, 245));
setColor("gui.tooltip.background", QColor(250, 252, 254));
setColor("gui.tooltip.foreground", QColor(42, 44, 46));
// Graph Overview
setColor("gui.overview.node", QColor(245, 250, 255));
setColor("gui.overview.fill", QColor(175, 217, 234, 65));
setColor("gui.overview.border", QColor(99, 218, 232, 50));
}
void Configuration::loadBaseThemeDark()
void Configuration::loadDarkStylesheet()
{
/* Load Qt Theme */
QFile f(":qdarkstyle/style.qss");
@ -333,50 +337,6 @@ void Configuration::loadBaseThemeDark()
qApp->setPalette(p);
qApp->setStyleSheet(stylesheet);
}
/* Colors */
// GUI
setColor("gui.cflow", QColor(255, 255, 255));
setColor("gui.dataoffset", QColor(255, 255, 255));
// Custom
setColor("gui.imports", QColor(50, 140, 255));
setColor("gui.item_invalid", QColor(155, 155, 155));
setColor("gui.item_unsafe", QColor(255, 129, 123));
setColor("gui.main", QColor(0, 128, 0));
// GUI: navbar
setColor("gui.navbar.seek", QColor(233, 86, 86));
setColor("gui.navbar.pc", QColor(66, 238, 244));
setColor("gui.navbar.code", QColor(130, 200, 111));
setColor("gui.navbar.str", QColor(111, 134, 216));
setColor("gui.navbar.sym", QColor(221, 163, 104));
setColor("gui.navbar.empty", QColor(100, 100, 100));
// RIP line selection in debug
setColor("highlightPC", QColor(87, 26, 7));
setColor("gui.breakpoint_background", QColor(140, 76, 76));
// Graph Overview
setColor("gui.overview.node", QColor(100, 100, 100));
setColor("gui.overview.fill", QColor(255, 255, 255, 40));
setColor("gui.overview.border", QColor(99, 218, 232, 50));
}
void Configuration::loadDarkTheme()
{
loadBaseThemeDark();
setColor("gui.border", QColor(100, 100, 100));
// Windows background
setColor("gui.background", QColor(37, 40, 43));
// Disassembly nodes background
setColor("gui.alt_background", QColor(28, 31, 36));
// Disassembly nodes background when selected
setColor("gui.disass_selected", QColor(31, 34, 40));
// Disassembly line selected
setColor("gui.tooltip.background", QColor(42, 44, 46));
setColor("gui.tooltip.foreground", QColor(250, 252, 254));
setColor("lineHighlight", QColor(21, 29, 29, 150));
setColor("wordHighlight", QColor(52, 58, 71, 255));
}
const QFont Configuration::getFont() const
@ -399,21 +359,26 @@ QString Configuration::getLastThemeOf(const CutterInterfaceTheme &currInterfaceT
void Configuration::setInterfaceTheme(int theme)
{
if (theme >= kCutterInterfaceThemesList.size() ||
if (theme >= cutterInterfaceThemesList().size() ||
theme < 0) {
theme = 0;
}
s.setValue("ColorPalette", theme);
QString themeName = kCutterInterfaceThemesList[theme].name;
if (themeName == "Native") {
loadNativeTheme();
} else if (themeName == "Dark") {
loadDarkTheme();
} else if (themeName == "Light") {
loadLightTheme();
CutterInterfaceTheme interfaceTheme = cutterInterfaceThemesList()[theme];
if (interfaceTheme.name == "Native") {
loadNativeStylesheet();
} else if (interfaceTheme.name == "Dark") {
loadDarkStylesheet();
} else if (interfaceTheme.name == "Light") {
loadLightStylesheet();
} else {
loadNativeTheme();
loadNativeStylesheet();
}
for (auto it = cutterOptionColors.cbegin(); it != cutterOptionColors.cend(); it++) {
setColor(it.key(), it.value()[interfaceTheme.flag]);
}
emit interfaceThemeChanged();
@ -423,11 +388,11 @@ void Configuration::setInterfaceTheme(int theme)
const CutterInterfaceTheme *Configuration::getCurrentTheme()
{
int i = getInterfaceTheme();
if (i < 0 || i >= kCutterInterfaceThemesList.size()) {
if (i < 0 || i >= cutterInterfaceThemesList().size()) {
i = 0;
setInterfaceTheme(i);
}
return &kCutterInterfaceThemesList[i];
return &cutterInterfaceThemesList()[i];
}
QString Configuration::getLogoFile()
@ -480,11 +445,6 @@ void Configuration::setColorTheme(const QString &theme)
setColor(it.key(), QColor(rgb[0].toInt(), rgb[1].toInt(), rgb[2].toInt(), rgb[3].toInt()));
}
// Trick Cutter to load colors that are not specified in standard theme
if (!ThemeWorker().isCustomTheme(theme)) {
setInterfaceTheme(getInterfaceTheme());
}
emit colorsUpdated();
}
@ -502,6 +462,16 @@ void Configuration::applySavedAsmOptions()
}
}
const QList<CutterInterfaceTheme>& Configuration::cutterInterfaceThemesList()
{
static const QList<CutterInterfaceTheme> list = {
{ "Native", Configuration::nativeWindowIsDark() ? DarkFlag : LightFlag },
{ "Dark", DarkFlag },
{ "Light", LightFlag }
};
return list;
}
QVariant Configuration::getConfigVar(const QString &key)
{
QHash<QString, QVariant>::const_iterator it = asmOptions.find(key);

View File

@ -18,7 +18,6 @@ struct CutterInterfaceTheme {
ColorFlags flag;
};
extern const QList<CutterInterfaceTheme> kCutterInterfaceThemesList;
class Configuration : public QObject
{
@ -31,14 +30,18 @@ private:
// Colors
void loadBaseThemeNative();
void loadBaseThemeDark();
void loadNativeTheme();
void loadLightTheme();
void loadDarkTheme();
void loadNativeStylesheet();
void loadLightStylesheet();
void loadDarkStylesheet();
// Asm Options
void applySavedAsmOptions();
public:
static const QList<CutterInterfaceTheme>& cutterInterfaceThemesList();
static const QHash<QString, ColorFlags> relevantThemes;
static const QHash<QString, QHash<ColorFlags, QColor>> cutterOptionColors;
// Functions
Configuration();
static Configuration *instance();
@ -63,6 +66,7 @@ public:
// Colors
bool windowColorIsDark();
static bool nativeWindowIsDark();
void setLastThemeOf(const CutterInterfaceTheme &currInterfaceTheme, const QString &theme);
QString getLastThemeOf(const CutterInterfaceTheme &currInterfaceTheme) const;
void setInterfaceTheme(int theme);

View File

@ -80,11 +80,11 @@ void AppearanceOptionsWidget::updateThemeFromConfig(bool interfaceThemeChanged)
QSignalBlocker signalBlockerThemeBox(ui->themeComboBox);
ui->themeComboBox->clear();
for (auto &it : kCutterInterfaceThemesList) {
for (auto &it : Configuration::cutterInterfaceThemesList()) {
ui->themeComboBox->addItem(it.name);
}
int currInterfaceThemeIndex = Config()->getInterfaceTheme();
if (currInterfaceThemeIndex >= kCutterInterfaceThemesList.size()) {
if (currInterfaceThemeIndex >= Configuration::cutterInterfaceThemesList().size()) {
currInterfaceThemeIndex = 0;
Config()->setInterfaceTheme(currInterfaceThemeIndex);
}

View File

@ -16,6 +16,12 @@ ColorThemeEditDialog::ColorThemeEditDialog(QWidget *parent) :
configSignalBlocker(Config()), // Blocks signals from Config to avoid updating of widgets during editing
colorTheme(Config()->getColorTheme())
{
showAlphaOptions = {
"gui.overview.border",
"gui.overview.fill",
"wordHighlight",
"lineHighlight"
};
ui->setupUi(this);
ui->colorComboBox->setShowOnlyCustom(true);
@ -41,7 +47,7 @@ ColorThemeEditDialog::ColorThemeEditDialog(QWidget *parent) :
.data(Qt::UserRole)
.value<ColorOption>()
.optionName;
ui->colorPicker->setAlphaEnabled(optionName == "wordHighlight" || optionName == "lineHighlight");
ui->colorPicker->setAlphaEnabled(showAlphaOptions.contains(optionName));
});
ui->colorThemeListView->setCurrentIndex(ui->colorThemeListView->model()->index(0, 0));

View File

@ -43,6 +43,7 @@ private:
bool themeWasEdited(const QString &theme) const;
private:
QList<QString> showAlphaOptions;
Ui::ColorThemeEditDialog *ui;
QSignalBlocker configSignalBlocker;
DisassemblyWidget *previewDisasmWidget;

View File

@ -5,24 +5,6 @@
#include "common/ColorThemeWorker.h"
#include "common/Configuration.h"
/* Map with names of themes associated with its color palette
* (Dark or Light), so for dark interface themes will be shown only Dark color themes
* and for light - only light ones.
*/
static const QHash<QString, ColorFlags> kRelevantThemes = {
{ "ayu", DarkFlag },
{ "consonance", DarkFlag },
{ "darkda", DarkFlag },
{ "onedark", DarkFlag },
{ "solarized", DarkFlag },
{ "zenburn", DarkFlag },
{ "cutter", LightFlag },
{ "dark", LightFlag },
{ "matrix", LightFlag },
{ "tango", LightFlag },
{ "white", LightFlag }
};
ColorThemeComboBox::ColorThemeComboBox(QWidget *parent) : QComboBox(parent), showOnlyCustom(false)
{
connect(this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
@ -42,13 +24,14 @@ void ColorThemeComboBox::updateFromConfig(bool interfaceThemeChanged)
clear();
for (const QString &theme : themes) {
if (ThemeWorker().isCustomTheme(theme) ||
(kCutterInterfaceThemesList[curInterfaceThemeIndex].flag & kRelevantThemes[theme])) {
(Configuration::cutterInterfaceThemesList()[curInterfaceThemeIndex].flag &
Configuration::relevantThemes[theme])) {
addItem(theme);
}
}
QString curTheme = interfaceThemeChanged
? Config()->getLastThemeOf(kCutterInterfaceThemesList[curInterfaceThemeIndex])
? Config()->getLastThemeOf(Configuration::cutterInterfaceThemesList()[curInterfaceThemeIndex])
: Config()->getColorTheme();
const int index = findText(curTheme);
@ -73,12 +56,12 @@ void ColorThemeComboBox::onCurrentIndexChanged(int index)
QString theme = itemText(index);
int curQtThemeIndex = Config()->getInterfaceTheme();
if (curQtThemeIndex >= kCutterInterfaceThemesList.size()) {
if (curQtThemeIndex >= Configuration::cutterInterfaceThemesList().size()) {
curQtThemeIndex = 0;
Config()->setInterfaceTheme(curQtThemeIndex);
}
Config()->setLastThemeOf(kCutterInterfaceThemesList[curQtThemeIndex], theme);
Config()->setLastThemeOf(Configuration::cutterInterfaceThemesList()[curQtThemeIndex], theme);
Config()->setColorTheme(theme);
}

View File

@ -133,7 +133,21 @@ void ColorOptionDelegate::paint(QPainter *painter,
QPainterPath roundedColorRect;
roundedColorRect.addRoundedRect(colorRect, fontHeight / 4, fontHeight / 4);
painter->setPen(Qt::NoPen);
// Create chess-like pattern of black and white squares
// and fill background of roundedColorRect with it
if (currCO.color.alpha() < 255) {
const int c1 = static_cast<int>(8 * painter->device()->devicePixelRatioF());
const int c2 = c1 / 2;
QPixmap p(c1, c1);
QPainter paint(&p);
paint.fillRect(0, 0, c1, c1, Qt::white);
paint.fillRect(0, 0, c2, c2, Qt::black);
paint.fillRect(c2, c2, c2, c2, Qt::black);
QBrush b;
b.setTexture(p);
painter->fillPath(roundedColorRect, b);
}
painter->setPen(currCO.color);
painter->fillPath(roundedColorRect, currCO.color);
QString desc = painter->fontMetrics().elidedText(