Plasma
checkbox.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "checkbox.h"
00021
00022
00023 #include <QPainter>
00024
00025
00026 #include <Plasma/Theme>
00027
00028 CheckBox::CheckBox(QWidget *parent)
00029 : QCheckBox(parent),
00030 m_styleOptionButton(),
00031 m_initialized(false)
00032 {
00033 connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(updateStyle()));
00034 }
00035
00036 void CheckBox::updateStyle()
00037 {
00038 initStyleOption(&m_styleOptionButton);
00039 m_styleOptionButton.palette.setColor(QPalette::WindowText, Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
00040 }
00041
00042 void CheckBox::paintEvent(QPaintEvent *event)
00043 {
00044 Q_UNUSED(event)
00045 QPainter painter(this);
00046 if (!m_initialized) {
00047 updateStyle();
00048 }
00049 style()->drawControl(QStyle::CE_CheckBox, &m_styleOptionButton, &painter, this);
00050 }
00051
00052 #include "checkbox.moc"