[Libreoffice-commits] .: 2 commits - vcl/unx

Lubos Lunak llunak at kemper.freedesktop.org
Mon Jan 17 12:00:46 PST 2011


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

New commits:
commit aa77be5b79314f713e44a1f20e588aa3ac82e315
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Mon Jan 17 20:59:21 2011 +0100

    paint toolbar handle positioned properly (fdo#32558)
    
    The problem was that we passed the whole widget geomtry to QStyle
    but it expected only geometry of the handle and e.g. Oxygen used
    center of the geometry.

diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index 10f744e..57db700 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
 
@@ -383,17 +384,16 @@ 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)
     {
commit 1a78f3ba64bb48d203b28d95aea64d8e5eccc3df
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Mon Jan 17 20:20:06 2011 +0100

    change the adjust argument to more versatile QRect

diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index bdfd0e2..10f744e 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -174,12 +174,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);
@@ -401,10 +399,10 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
     {
         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