diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2011-04-08 16:30:34 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2011-04-08 21:56:41 +0200 |
commit | 9feed4636ad91bd804af7929c845ccda6a941da0 (patch) | |
tree | bf9538fa0ec81f8ecdb842382aebf90c2bda4194 /vcl/unx/kde4/KDESalGraphics.cxx | |
parent | 6ce101d8c446f6639cee21a229ccde6eb42d812e (diff) |
provide scrollbar track area, to fix detection of KDE4 scrollbar areas
Diffstat (limited to 'vcl/unx/kde4/KDESalGraphics.cxx')
-rw-r--r-- | vcl/unx/kde4/KDESalGraphics.cxx | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 9a7771dc3956..ddfb06ccd64d 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -860,6 +860,35 @@ sal_Bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart p } break; } + case CTRL_SCROLLBAR: + { + // core can't handle 3-button scrollbars well, so we fix that in hitTestNativeControl(), + // for the rest also provide the track area (i.e. area not taken by buttons) + if( part == PART_TRACK_VERT_AREA || part == PART_TRACK_HORZ_AREA ) + { + QStyleOptionSlider option; + OSL_ASSERT( val.getType() == CTRL_SCROLLBAR ); + const ScrollbarValue* sbVal = static_cast<const ScrollbarValue *>(&val); + option.orientation = ( part == PART_TRACK_HORZ_AREA ) ? Qt::Horizontal : Qt::Vertical; + option.minimum = sbVal->mnMin; + option.maximum = sbVal->mnMax; + option.sliderValue = sbVal->mnCur; + option.sliderPosition = sbVal->mnCur; + option.pageStep = sbVal->mnVisibleSize; + // Adjust coordinates to make the widget appear to be at (0,0), i.e. make + // widget and screen coordinates the same. QStyle functions should use screen + // coordinates but at least QPlastiqueStyle::subControlRect() is buggy + // and sometimes uses widget coordinates. + QRect rect = contentRect; + rect.moveTo( 0, 0 ); + option.rect = rect; + rect = kapp->style()->subControlRect( QStyle::CC_ScrollBar, &option, + QStyle::SC_ScrollBarGroove ); + rect.translate( contentRect.topLeft()); // reverse the workaround above + contentRect = boundingRect = rect; + retVal = true; + } + } default: break; } @@ -892,7 +921,8 @@ sal_Bool KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nP { if( nPart != PART_BUTTON_UP && nPart != PART_BUTTON_DOWN && nPart != PART_BUTTON_LEFT && nPart != PART_BUTTON_RIGHT ) - { // we adjust only for buttons (because some scrollbars have 3 buttons) + { // we adjust only for buttons (because some scrollbars have 3 buttons, + // and LO core doesn't handle such scrollbars well) return FALSE; } rIsInside = FALSE; |