mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-29 19:28:47 -05:00
29 lines
833 B
C++
29 lines
833 B
C++
#include <QPainter>
|
|
#include "gui/buttonswitch.h"
|
|
|
|
ButtonSwitch::ButtonSwitch(QWidget* parent) :
|
|
QToolButton(parent)
|
|
{
|
|
setCheckable(true);
|
|
setStyleSheet(QString("QToolButton{ background-color: %1; } QToolButton:checked{ background-color: %2; }")
|
|
.arg(palette().button().color().name())
|
|
.arg(palette().highlight().color().darker(150).name()));
|
|
}
|
|
|
|
void ButtonSwitch::doToggle(bool checked)
|
|
{
|
|
setChecked(checked);
|
|
}
|
|
|
|
void ButtonSwitch::setColor(QColor color)
|
|
{
|
|
setStyleSheet(QString("QToolButton{ background-color: %1; }").arg(color.name()));
|
|
}
|
|
|
|
void ButtonSwitch::resetColor()
|
|
{
|
|
setStyleSheet(QString("QToolButton{ background-color: %1; } QToolButton:checked{ background-color: %2; }")
|
|
.arg(palette().button().color().name())
|
|
.arg(palette().highlight().color().darker(150).name()));
|
|
}
|