1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-04 23:14:47 -04:00

Button switch: added methods to set color and reset to default button colors

This commit is contained in:
f4exb
2020-08-02 00:59:42 +02:00
parent fa554d8244
commit b747966c8e
2 changed files with 24 additions and 0 deletions
+22
View File
@@ -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);
}
}