[Libreoffice-commits] .: Branch 'libreoffice-3-3' - vcl/unx

Lubos Lunak llunak at kemper.freedesktop.org
Tue Jan 18 03:34:23 PST 2011


 vcl/unx/kde4/KDESalGraphics.cxx |   22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

New commits:
commit 3c13a7752cc1904e7a6a88380c10a2433a83feb8
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue Jan 18 12:33:16 2011 +0100

    paint toolbar handle positioned properly (fdo#32558)
    
    ACK by Kendy.

diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index fb8b3b9..af1ac3b 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -40,6 +40,7 @@
 #include <QLabel>
 
 #include <kapplication.h>
+#include <kdebug.h>
 
 #undef Region
 
@@ -174,12 +175,10 @@ namespace
         kapp->style()->drawControl(element, option, &painter);
     }
 
-    void draw( QStyle::PrimitiveElement element, QStyleOption* option, QImage* image, QStyle::State state, int nAdjust = 0 )
+    void draw( QStyle::PrimitiveElement element, QStyleOption* option, QImage* image, QStyle::State state, QRect rect = QRect())
     {
         option->state |= state;
-        option->rect = image->rect();
-        if( nAdjust )
-            option->rect.adjust( nAdjust, nAdjust, -nAdjust, -nAdjust );
+        option->rect = !rect.isNull() ? rect : image->rect();
         
         QPainter painter(image);
         kapp->style()->drawPrimitive(element, option, &painter);
@@ -352,26 +351,25 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
               vclStateValue2StateFlag(nControlState, value) );
     }
     else if ( (type == CTRL_TOOLBAR) && (part == PART_THUMB_VERT) )
-    {
-        const int tw = widgetRect.width();
-        widgetRect.setWidth(kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent));
+    {   // reduce paint area only to the handle area
+        const int width = kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent);
+        QRect rect( 0, 0, width, widgetRect.height());
+        clipRegion = new QRegion( widgetRect.x(), widgetRect.y(), width, widgetRect.height());
         
         QStyleOption option;
         option.state = QStyle::State_Horizontal;
         
         draw( QStyle::PE_IndicatorToolBarHandle, &option, m_image, 
-              vclStateValue2StateFlag(nControlState, value) );
-        
-        widgetRect.setWidth(tw);
+              vclStateValue2StateFlag(nControlState, value), rect );
     }
     else if (type == CTRL_EDITBOX)
     {
         QStyleOptionFrameV2 option;
         draw( QStyle::PE_PanelLineEdit, &option, m_image,
-              vclStateValue2StateFlag(nControlState, value), 2 );
+              vclStateValue2StateFlag(nControlState, value), m_image->rect().adjusted( 2, 2, -2, -2 ));
         
         draw( QStyle::PE_FrameLineEdit, &option, m_image,
-              vclStateValue2StateFlag(nControlState, value), 0 );
+              vclStateValue2StateFlag(nControlState, value));
     }
     else if (type == CTRL_COMBOBOX)
     {


More information about the Libreoffice-commits mailing list