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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/generic/applets/analog-clock
From:       Alexis Ménard <menard () kde ! org>
Date:       2009-10-07 9:11:53
Message-ID: 1254906713.548005.32743.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1032190 by menard:

Fix update issues when the applet is resized with the handle.

 M  +25 -18    clock.cpp  
 M  +1 -0      clock.h  


--- trunk/KDE/kdebase/workspace/plasma/generic/applets/analog-clock/clock.cpp \
#1032189:1032190 @@ -114,24 +114,8 @@
 {
     ClockApplet::constraintsEvent(constraints);
 
-    if (constraints & Plasma::SizeConstraint) {
-        m_repaintCache = RepaintAll;
-
-        QSize pixmapSize = contentsRect().size().toSize();
-
-        if (m_showingTimezone) {
-            QRect tzArea = tzRect();
-            pixmapSize.setHeight(qMax(10, pixmapSize.height() - tzArea.height()));
-            tzFrame()->resizeFrame(tzArea.size());
-        }
-
-        pixmapSize.setWidth(pixmapSize.height());
-        m_faceCache = QPixmap(pixmapSize);
-        m_handsCache = QPixmap(pixmapSize);
-        m_glassCache = QPixmap(pixmapSize);
-
-        m_theme->resize(pixmapSize);
-    }
+    if (constraints & Plasma::SizeConstraint)
+        invalidateCache();
 }
 
 QPainterPath Clock::shape() const
@@ -342,6 +326,9 @@
         }
     }
 
+    if (contentsRect().size().toSize() != m_theme->size())
+        invalidateCache();
+
     // paint face and glass cache
     QRect faceRect = m_faceCache.rect();
     if (m_repaintCache == RepaintAll) {
@@ -432,4 +419,24 @@
     return m_tzFrame;
 }
 
+void Clock::invalidateCache()
+{
+    m_repaintCache = RepaintAll;
+
+    QSize pixmapSize = contentsRect().size().toSize();
+
+    if (m_showingTimezone) {
+        QRect tzArea = tzRect();
+        pixmapSize.setHeight(qMax(10, pixmapSize.height() - tzArea.height()));
+        tzFrame()->resizeFrame(tzArea.size());
+    }
+
+    pixmapSize.setWidth(pixmapSize.height());
+    m_faceCache = QPixmap(pixmapSize);
+    m_handsCache = QPixmap(pixmapSize);
+    m_glassCache = QPixmap(pixmapSize);
+
+    m_theme->resize(pixmapSize);
+}
+
 #include "clock.moc"
--- trunk/KDE/kdebase/workspace/plasma/generic/applets/analog-clock/clock.h \
#1032189:1032190 @@ -71,6 +71,7 @@
         void drawHand(QPainter *p, const QRect &rect, const qreal \
verticalTranslation, const qreal rotation, const QString &handName);  QRect tzRect();
         Plasma::FrameSvg *tzFrame();
+        void invalidateCache();
 
         bool m_showSecondHand;
         bool m_fancyHands;


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

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