You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
461 B
21 lines
461 B
#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); |
|
} |
|
}
|
|
|