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

List:       kde-commits
Subject:    KDE/kdebase/workspace/libs/plasmagenericshell
From:       Marco Martin <notmart () gmail ! com>
Date:       2010-12-07 17:22:35
Message-ID: 20101207172236.007E0AC8A5 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1204507 by mart:

fix background borders
update them when the theme changes


 M  +14 -4     abstracticon.cpp  
 M  +3 -0      abstracticon.h  


--- trunk/KDE/kdebase/workspace/libs/plasmagenericshell/abstracticon.cpp #1204506:1204507
@@ -53,26 +53,36 @@
       m_selected(false),
       m_hovered(false)
 {
+    setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
     setCacheMode(DeviceCoordinateCache);
     setAcceptHoverEvents(true);
     m_background->setCacheAllRenderedFrames(true);
     m_background->setImagePath("widgets/tasks");
+    connect(m_background, SIGNAL(repaintNeeded()), this, SLOT(syncTheme()));
+    syncTheme();
 }
 
 AbstractIcon::~AbstractIcon()
 {
 }
 
-void AbstractIcon::resizeEvent(QGraphicsSceneResizeEvent *)
+void AbstractIcon::syncTheme()
 {
+    m_background->setElementPrefix("normal");
     m_background->resizeFrame(size());
     qreal ml, mt, mr, mb;
     m_background->getMargins(ml, mt, mr, mb);
-    qreal l, t, r, b;
-    getContentsMargins(&l, &t, &r, &b);
-    setContentsMargins(qMax(l, ml), qMax(t, mt), qMax(r, mr), qMax(b, mb));
+
+    setContentsMargins(ml, mt, mr, mb);
+    updateGeometry();
+    update();
 }
 
+void AbstractIcon::resizeEvent(QGraphicsSceneResizeEvent *event)
+{
+    m_background->resizeFrame(event->newSize());
+}
+
 QSizeF AbstractIcon::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
 {
     if (which == Qt::MinimumSize || which == Qt::PreferredSize) {
--- trunk/KDE/kdebase/workspace/libs/plasmagenericshell/abstracticon.h #1204506:1204507
@@ -76,6 +76,9 @@
     public Q_SLOTS:
         void setName(const QString &name);
 
+    protected Q_SLOTS:
+        void syncTheme();
+
     protected:
         //listen to events and emit signals
         void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
[prev in list] [next in list] [prev in thread] [next in thread] 

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