18#include <QColorDialog>
23 setAutoFillBackground(
true);
30 QColor newColor = QColorDialog::getColor(
_color,
nullptr,
"Choose a color");
31 if (!newColor.isValid())
43 QString colorStr =
"rgb";
51 QString colorStr =
"(";
52 colorStr.append(QString::number(color.red()));
53 colorStr.append(
", ");
54 colorStr.append(QString::number(color.green()));
55 colorStr.append(
", ");
56 colorStr.append(QString::number(color.blue()));
67 QColor hsv =
_color.toHsv();
69 if (hsv.valueF() < 0.5f)
71 textColorStr =
"color: rgb(255, 255, 255);";
75 textColorStr =
"color: rgb(0, 0, 0);";
78 QString stylesheetStr =
"background-color: ";
80 stylesheetStr.append(
";");
81 stylesheetStr.append(textColorStr);
82 this->setStyleSheet(stylesheetStr);
89 setColor(QColor::fromRgbF(color[0], color[1], color[2]));