mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-12 19:36:10 -05:00
Button switch: added methods to set color and reset to default button colors
This commit is contained in:
parent
fa554d8244
commit
b747966c8e
@ -31,3 +31,25 @@ void ButtonSwitch::doToggle(bool checked)
|
||||
{
|
||||
onToggled(checked);
|
||||
}
|
||||
|
||||
void ButtonSwitch::setColor(QColor color)
|
||||
{
|
||||
QPalette p = m_originalPalette;
|
||||
p.setColor(QPalette::Button, color);
|
||||
setPalette(p);
|
||||
}
|
||||
|
||||
void ButtonSwitch::resetColor()
|
||||
{
|
||||
if (isChecked())
|
||||
{
|
||||
QPalette p = m_originalPalette;
|
||||
p.setColor(QPalette::Button, QColor(0x80, 0x46, 0x00));
|
||||
setPalette(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
setPalette(m_originalPalette);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ class SDRGUI_API ButtonSwitch : public QToolButton {
|
||||
public:
|
||||
ButtonSwitch(QWidget* parent = NULL);
|
||||
void doToggle(bool checked);
|
||||
void setColor(QColor color);
|
||||
void resetColor();
|
||||
|
||||
private slots:
|
||||
void onToggled(bool checked);
|
||||
|
Loading…
Reference in New Issue
Block a user