SDRAngel
4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
sdrgui
gui
buttonswitch.cpp
Go to the documentation of this file.
1
#include <QPainter>
2
#include "
gui/buttonswitch.h
"
3
4
ButtonSwitch::ButtonSwitch
(QWidget* parent) :
5
QToolButton(parent)
6
{
7
setCheckable(
true
);
8
m_originalPalette
= palette();
9
connect(
this
, SIGNAL(toggled(
bool
)),
this
, SLOT(
onToggled
(
bool
)));
10
}
11
12
void
ButtonSwitch::onToggled
(
bool
checked)
13
{
14
if
(checked) {
15
QPalette p =
m_originalPalette
;
16
p.setColor(QPalette::Button, QColor(0x80, 0x46, 0x00));
17
setPalette(p);
18
}
else
{
19
setPalette(
m_originalPalette
);
20
}
21
}
22
23
void
ButtonSwitch::doToggle
(
bool
checked)
24
{
25
onToggled
(checked);
26
}
ButtonSwitch::m_originalPalette
QPalette m_originalPalette
Definition:
buttonswitch.h:19
buttonswitch.h
ButtonSwitch::onToggled
void onToggled(bool checked)
Definition:
buttonswitch.cpp:12
ButtonSwitch::ButtonSwitch
ButtonSwitch(QWidget *parent=NULL)
Definition:
buttonswitch.cpp:4
ButtonSwitch::doToggle
void doToggle(bool checked)
Definition:
buttonswitch.cpp:23
Generated on Fri Aug 2 2019 17:56:33 for SDRAngel by
1.8.13