| 8 | namespace advss { |
| 9 | |
| 10 | VariableColorButton::VariableColorButton(QWidget *parent, |
| 11 | const QString &selectText) |
| 12 | : QWidget(parent), |
| 13 | _colorSwatch(new QLabel()), |
| 14 | _selectColor(new QPushButton(selectText)), |
| 15 | _variable(new VariableSelection(this)), |
| 16 | _toggleType(new QPushButton()) |
| 17 | { |
| 18 | _toggleType->setCheckable(true); |
| 19 | _toggleType->setMaximumWidth(11); |
| 20 | SetButtonIcon(_toggleType, GetThemeTypeName() == "Light" |
| 21 | ? ":/res/images/dots-vert.svg" |
| 22 | : "theme:Dark/dots-vert.svg"); |
| 23 | |
| 24 | QWidget::connect(_selectColor, SIGNAL(clicked()), this, |
| 25 | SLOT(SelectColorClicked())); |
| 26 | QWidget::connect(_toggleType, SIGNAL(toggled(bool)), this, |
| 27 | SLOT(ToggleTypeClicked(bool))); |
| 28 | QWidget::connect(_variable, SIGNAL(SelectionChanged(const QString &)), |
| 29 | this, SLOT(VariableChanged(const QString &))); |
| 30 | |
| 31 | auto layout = new QHBoxLayout(); |
| 32 | layout->setContentsMargins(0, 0, 0, 0); |
| 33 | layout->addWidget(_colorSwatch); |
| 34 | layout->addWidget(_selectColor); |
| 35 | layout->addWidget(_variable); |
| 36 | layout->addWidget(_toggleType); |
| 37 | setLayout(layout); |
| 38 | SetVisibility(); |
| 39 | } |
| 40 | |
| 41 | void VariableColorButton::SetValue(const ColorVariable &color) |
| 42 | { |
nothing calls this directly
no test coverage detected