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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets/tasks
From:       Marco Martin <notmart () gmail ! com>
Date:       2009-09-13 17:24:46
Message-ID: 1252862686.012317.8164.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1022995 by mart:

try to avoid resizing in paintevent by resizing the framesvg in
resizeevent. however since the framesvg is shared and there are
different sized tasks (popups) sometimes could still be necessary to
resize in the paintevent


 M  +15 -5     abstracttaskitem.cpp  
 M  +1 -0      abstracttaskitem.h  


--- trunk/KDE/kdebase/workspace/plasma/applets/tasks/abstracttaskitem.cpp \
#1022994:1022995 @@ -548,18 +548,23 @@
 
     syncActiveRect();
 
+    resizeBackground(event->newSize().toSize());
+}
+
+void AbstractTaskItem::resizeBackground(const QSize &size)
+{
     Plasma::FrameSvg *itemBackground = m_applet->itemBackground();
 
     itemBackground->setElementPrefix("focus");
-    m_applet->resizeItemBackground(event->newSize().toSize());
+    m_applet->resizeItemBackground(size);
     itemBackground->setElementPrefix("normal");
-    m_applet->resizeItemBackground(event->newSize().toSize());
+    m_applet->resizeItemBackground(size);
     itemBackground->setElementPrefix("minimized");
-    m_applet->resizeItemBackground(event->newSize().toSize());
+    m_applet->resizeItemBackground(size);
     itemBackground->setElementPrefix("attention");
-    m_applet->resizeItemBackground(event->newSize().toSize());
+    m_applet->resizeItemBackground(size);
     itemBackground->setElementPrefix("hover");
-    m_applet->resizeItemBackground(m_activeRect.size().toSize());
+    m_applet->resizeItemBackground(size);
 
     //restore the prefix
     itemBackground->setElementPrefix(m_backgroundPrefix);
@@ -578,6 +583,11 @@
     */
     Plasma::FrameSvg *itemBackground = m_applet->itemBackground();
 
+    //since a single framesvg is shared between all tasks, we could have to resize \
it even if there wasn't a resizeevent +    if (size().toSize() != \
itemBackground->frameSize()) { +        resizeBackground(size().toSize());
+    }
+
     if (!m_animId && ~option->state & QStyle::State_Sunken) {
         itemBackground->setElementPrefix(m_backgroundPrefix);
         if (itemBackground->frameSize() == m_activeRect.size().toSize()) {
--- trunk/KDE/kdebase/workspace/plasma/applets/tasks/abstracttaskitem.h \
#1022994:1022995 @@ -205,6 +205,7 @@
     void fadeBackground(const QString &newBackground, int duration, bool fadeIn);
     // text color, use this because it could be animated
     QColor textColor() const;
+    void resizeBackground(const QSize &size);
 
     void resizeEvent(QGraphicsSceneResizeEvent *event);
 


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

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