update with the theme

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=823768
This commit is contained in:
Aaron J. Seigo 2008-06-24 03:15:56 +00:00
parent f359a0f551
commit 03d7946373
2 changed files with 21 additions and 10 deletions

View File

@ -34,8 +34,9 @@ namespace Plasma
class Label::Private class Label::Private
{ {
public: public:
Private() Private(Label *label)
: svg(0) : q(label),
svg(0)
{ {
} }
@ -64,6 +65,17 @@ public:
static_cast<QLabel*>(q->widget())->setPixmap(pm); static_cast<QLabel*>(q->widget())->setPixmap(pm);
} }
void setPalette()
{
QLabel *native = q->nativeWidget();
QColor color = Theme::defaultTheme()->color(Theme::TextColor);
QPalette p = native->palette();
p.setColor(QPalette::Normal, QPalette::WindowText, color);
p.setColor(QPalette::Inactive, QPalette::WindowText, color);
native->setPalette(p);
}
Label *q;
QString imagePath; QString imagePath;
QString absImagePath; QString absImagePath;
Svg *svg; Svg *svg;
@ -71,18 +83,15 @@ public:
Label::Label(QGraphicsWidget *parent) Label::Label(QGraphicsWidget *parent)
: QGraphicsProxyWidget(parent), : QGraphicsProxyWidget(parent),
d(new Private) d(new Private(this))
{ {
QLabel* native = new QLabel; QLabel* native = new QLabel;
QPalette p = native->palette();
QColor color = Theme::defaultTheme()->color(Theme::TextColor); connect(Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(setPalette()));
p.setColor(QPalette::Normal, QPalette::WindowText, color);
p.setColor(QPalette::Inactive, QPalette::WindowText, color);
native->setPalette(p);
setWidget(native);
native->setAttribute(Qt::WA_NoSystemBackground); native->setAttribute(Qt::WA_NoSystemBackground);
native->setWordWrap(true);
setWidget(native);
d->setPalette();
} }
Label::~Label() Label::~Label()

View File

@ -91,6 +91,8 @@ protected:
void resizeEvent(QGraphicsSceneResizeEvent *event); void resizeEvent(QGraphicsSceneResizeEvent *event);
private: private:
Q_PRIVATE_SLOT(d, void setPalette())
class Private; class Private;
Private * const d; Private * const d;
}; };