qtcollider: set absolute slider position on mouse click
[supercollider.git] / QtCollider / style / ProxyStyle.cpp
blob4c6c71808cb65f670007e35d4d9d911e84ccbf6e
1 #include "ProxyStyle.hpp"
3 #include <QWebView>
4 #include <QStyleOptionSlider>
5 #include <QPainter>
7 using namespace QtCollider;
9 #ifdef Q_OS_MAC
10 void ProxyStyle::drawComplexControl ( ComplexControl ctrl, const QStyleOptionComplex *opt,
11 QPainter *p, const QWidget * w) const
13 // FIXME this is a workaround for the WebKit bug #35681.
15 if( ctrl == QStyle::CC_ScrollBar
16 && qobject_cast<const QWebView*>(w) != 0
17 && opt->type == QStyleOption::SO_Slider )
19 const QPoint topLeft = opt->rect.topLeft();
21 p->save();
22 p->translate( topLeft );
24 const QStyleOptionSlider *optSlider = static_cast<const QStyleOptionSlider*>(opt);
25 QStyleOptionSlider opt2( *optSlider );
26 opt2.rect.moveTo( QPoint(0, 0) );
28 QProxyStyle::drawComplexControl( ctrl, &opt2, p, w );
30 p->restore();
32 return;
35 QProxyStyle::drawComplexControl( ctrl, opt, p, w );
37 #endif
39 int ProxyStyle::styleHint ( StyleHint hint, const QStyleOption * option,
40 const QWidget * widget, QStyleHintReturn * returnData ) const
42 switch( hint ) {
43 case QStyle::SH_Slider_AbsoluteSetButtons:
44 return Qt::LeftButton;
45 case QStyle::SH_Slider_PageSetButtons:
46 return Qt::NoButton;
47 default:
48 return QProxyStyle::styleHint( hint, option, widget, returnData );