mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-05 15:34:57 -04:00
git clone git://git.osmocom.org/sdrangelove.git
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#include <QPainter>
|
||||
#include "gui/buttonswitch.h"
|
||||
|
||||
ButtonSwitch::ButtonSwitch(QWidget* parent) :
|
||||
QToolButton(parent)
|
||||
{
|
||||
setCheckable(true);
|
||||
m_originalPalette = palette();
|
||||
connect(this, SIGNAL(toggled(bool)), this, SLOT(onToggled(bool)));
|
||||
}
|
||||
|
||||
void ButtonSwitch::onToggled(bool checked)
|
||||
{
|
||||
if(checked) {
|
||||
QPalette p = m_originalPalette;
|
||||
p.setColor(QPalette::Button, QColor(0x80, 0x46, 0x00));
|
||||
setPalette(p);
|
||||
} else {
|
||||
setPalette(m_originalPalette);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user