[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/libs/plasma/widgets
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2008-10-02 3:55:02
Message-ID: 1222919702.263578.26887.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 866855 by aseigo:

update when the theme does


 M  +11 -8     checkbox.cpp  
 M  +1 -0      checkbox.h  


--- trunk/KDE/kdebase/workspace/libs/plasma/widgets/checkbox.cpp #866854:866855
@@ -34,8 +34,9 @@
 class CheckBoxPrivate
 {
 public:
-    CheckBoxPrivate()
-        : svg(0)
+    CheckBoxPrivate(CheckBox *c)
+        : q(c),
+          svg(0)
     {
     }
 
@@ -44,7 +45,7 @@
         delete svg;
     }
 
-    void setPixmap(CheckBox *q)
+    void setPixmap()
     {
         if (imagePath.isEmpty()) {
             return;
@@ -64,7 +65,7 @@
         static_cast<QCheckBox*>(q->widget())->setIcon(QIcon(pm));
     }
 
-    void setPalette(CheckBox *q)
+    void setPalette()
     {
         QCheckBox *native = q->nativeWidget();
         QColor color = Theme::defaultTheme()->color(Theme::TextColor);
@@ -74,6 +75,7 @@
         native->setPalette(p);
     }
 
+    CheckBox *q;
     QString imagePath;
     QString absImagePath;
     Svg *svg;
@@ -81,13 +83,14 @@
 
 CheckBox::CheckBox(QGraphicsWidget *parent)
     : QGraphicsProxyWidget(parent),
-      d(new CheckBoxPrivate)
+      d(new CheckBoxPrivate(this))
 {
     QCheckBox* native = new QCheckBox;
     connect(native, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool)));
     setWidget(native);
-    d->setPalette(this);
+    d->setPalette();
     native->setAttribute(Qt::WA_NoSystemBackground);
+    connect(Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(setPalette()));
 }
 
 CheckBox::~CheckBox()
@@ -130,7 +133,7 @@
         d->absImagePath = Theme::defaultTheme()->imagePath(path);
     }
 
-    d->setPixmap(this);
+    d->setPixmap();
 }
 
 QString CheckBox::image() const
@@ -155,7 +158,7 @@
 
 void CheckBox::resizeEvent(QGraphicsSceneResizeEvent *event)
 {
-    d->setPixmap(this);
+    d->setPixmap();
     QGraphicsProxyWidget::resizeEvent(event);
 }
 
--- trunk/KDE/kdebase/workspace/libs/plasma/widgets/checkbox.h #866854:866855
@@ -112,6 +112,7 @@
     void resizeEvent(QGraphicsSceneResizeEvent *event);
 
 private:
+    Q_PRIVATE_SLOT(d, void setPalette())
     CheckBoxPrivate * const d;
 };
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic