From kde-commits Thu May 31 21:44:52 2012 From: =?utf-8?b?SXZhbiDEjHVracSH?= Date: Thu, 31 May 2012 21:44:52 +0000 To: kde-commits Subject: [kde-workspace] plasma/desktop/toolboxes: Include the icon size when calculating bounding rectangle Message-Id: <20120531214452.CBECDA60A9 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=133850088111190 Git commit 5079650532c7650f0617568f426d6f83c8c2ca15 by Ivan =C4=8Cuki=C4=87. 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/5079650532c7650f0617568f426d6f83c8c2ca= 15 diff --git a/plasma/desktop/toolboxes/desktoptoolbox.cpp b/plasma/desktop/t= oolboxes/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 =3D Plasma::Theme::defaultTheme()->fontMetrics().width(= m_containment->activity()+'x'); + extraSpace =3D iconSize().width() + + Plasma::Theme::defaultTheme()->fontMetrics().width(m_contain= ment->activity()+'x'); } = qreal left, top, right, bottom; @@ -364,7 +365,7 @@ void DesktopToolBox::paint(QPainter *painter, const QSt= yleOptionGraphicsItem *op m_background->contentsRect().width())); = textRect =3D 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() - icon= Size().height(), rect.left())); } else { Qt::Alignment alignment; = @@ -377,7 +378,7 @@ void DesktopToolBox::paint(QPainter *painter, const QSt= yleOptionGraphicsItem *op iconRect =3D QStyle::alignedRect(QApplication::layoutDirection(), = alignment, iconSize(), m_background->contentsRect().toRect()); = textRect =3D QStyle::alignedRect(QApplication::layoutDirection(), = Qt::AlignRight|Qt::AlignVCenter, textSize, m_background->contentsRect().toR= ect()); - textRect.moveTopLeft(textRect.topLeft() + rect.topLeft().toPoint()= ); + textRect.moveTopLeft(textRect.topLeft() + QPoint(rect.top() - icon= Size().height(), rect.left())); } = iconRect.moveTopLeft(iconRect.topLeft() + rect.topLeft().toPoint());