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

List:       kde-commits
Subject:    [kde-workspace] plasma/desktop/toolboxes: Include the icon size when calculating bounding rectangle
From:       Ivan Čukić <ivan.cukic () kde ! org>
Date:       2012-05-31 21:44:52
Message-ID: 20120531214452.CBECDA60A9 () git ! kde ! org
[Download RAW message or body]

Git commit 5079650532c7650f0617568f426d6f83c8c2ca15 by Ivan Čukić.
Committed on 31/05/2012 at 23:43.
Pushed by ivan into branch 'master'.

Include the icon size when calculating bounding rectangle

- fixes the painting glitch when dragging the toolbox handle
- not painting text outside of the toolbox handle

M  +4    -3    plasma/desktop/toolboxes/desktoptoolbox.cpp

http://commits.kde.org/kde-workspace/5079650532c7650f0617568f426d6f83c8c2ca15

diff --git a/plasma/desktop/toolboxes/desktoptoolbox.cpp \
b/plasma/desktop/toolboxes/desktoptoolbox.cpp index 4c0bf57..665357f 100644
--- a/plasma/desktop/toolboxes/desktoptoolbox.cpp
+++ b/plasma/desktop/toolboxes/desktoptoolbox.cpp
@@ -258,7 +258,8 @@ QRectF DesktopToolBox::boundingRect() const
 
     //keep space for the label and a character more
     if (!m_containment->activity().isNull()) {
-        extraSpace = \
Plasma::Theme::defaultTheme()->fontMetrics().width(m_containment->activity()+'x'); +  \
extraSpace = iconSize().width() +            + \
Plasma::Theme::defaultTheme()->fontMetrics().width(m_containment->activity()+'x');  }
 
     qreal left, top, right, bottom;
@@ -364,7 +365,7 @@ void DesktopToolBox::paint(QPainter *painter, const \
QStyleOptionGraphicsItem *op  m_background->contentsRect().width()));
 
         textRect = QStyle::alignedRect(QApplication::layoutDirection(), \
                Qt::AlignRight|Qt::AlignVCenter, textSize, boundRect);
-        textRect.moveTopLeft(textRect.topLeft() + QPoint(rect.top(), rect.left()));
+        textRect.moveTopLeft(textRect.topLeft() + QPoint(rect.top() - \
iconSize().height(), rect.left()));  } else {
         Qt::Alignment alignment;
 
@@ -377,7 +378,7 @@ void DesktopToolBox::paint(QPainter *painter, const \
                QStyleOptionGraphicsItem *op
         iconRect = QStyle::alignedRect(QApplication::layoutDirection(), alignment, \
iconSize(), m_background->contentsRect().toRect());  
         textRect = QStyle::alignedRect(QApplication::layoutDirection(), \
                Qt::AlignRight|Qt::AlignVCenter, textSize, \
                m_background->contentsRect().toRect());
-        textRect.moveTopLeft(textRect.topLeft() + rect.topLeft().toPoint());
+        textRect.moveTopLeft(textRect.topLeft() + QPoint(rect.top() - \
iconSize().height(), rect.left()));  }
 
     iconRect.moveTopLeft(iconRect.topLeft() + rect.topLeft().toPoint());


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

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