summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2011-01-18 12:33:16 +0100
committerLuboš Luňák <l.lunak@suse.cz>2011-01-18 12:33:16 +0100
commit96bb26df5b009c969d0999cfbb61faf2c27ffbf8 (patch)
tree256e6827d852ed97ac129e4f7fd587967eca1a92 /vcl
parentde2dd7a15678d2968cd7c22d74e7056c35a051f3 (diff)
paint toolbar handle positioned properly (fdo#32558)
ACK by Kendy.
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/kde4/KDESalGraphics.cxx22
1 files changed, 10 insertions, 12 deletions
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index 936167f8c879..9eba158ca15c 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)
{