31 |
31 |
32 /* |
32 /* |
33 * Constructs a color selection dialog. |
33 * Constructs a color selection dialog. |
34 */ |
34 */ |
35 ColorSelector::ColorSelector(QWidget* parent, LDColor defaultColor) : |
35 ColorSelector::ColorSelector(QWidget* parent, LDColor defaultColor) : |
36 QDialog {parent}, |
36 QDialog {parent}, |
37 HierarchyElement {parent}, |
|
38 ui {*new Ui_ColorSelUi}, |
37 ui {*new Ui_ColorSelUi}, |
39 m_selectedColor {LDColor::nullColor} |
38 m_selectedColor {LDColor::nullColor} |
40 { |
39 { |
41 ui.setupUi(this); |
40 ui.setupUi(this); |
42 |
41 |
53 { |
52 { |
54 QColor faceColor = color.faceColor(); |
53 QColor faceColor = color.faceColor(); |
55 |
54 |
56 if (color == MainColor) |
55 if (color == MainColor) |
57 { |
56 { |
58 faceColor = m_config->mainColor(); |
57 faceColor = ::config->mainColor(); |
59 faceColor.setAlphaF(m_config->mainColorAlpha()); |
58 faceColor.setAlphaF(::config->mainColorAlpha()); |
60 } |
59 } |
61 |
60 |
62 QString edgeColor = luma(faceColor) < 80 ? "white" : "black"; |
61 QString edgeColor = luma(faceColor) < 80 ? "white" : "black"; |
63 button->setAutoFillBackground(true); |
62 button->setAutoFillBackground(true); |
64 button->setStyleSheet(format( |
63 button->setStyleSheet(format( |
65 "background-color: #%1; color: %2;", |
64 "background-color: %1; color: %2; border:none;", |
66 faceColor.name(QColor::HexArgb), |
65 faceColor.name(QColor::HexArgb), |
67 edgeColor |
66 edgeColor |
68 )); |
67 )); |
69 button->setCheckable(true); |
68 button->setCheckable(true); |
70 button->setText(QString::number(color.index())); |
69 button->setText(QString::number(color.index())); |