pe = (spin->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus
: PE_IndicatorSpinUp);
copy.rect = aBtnRect;
- drawPrimitive(PE_IndicatorSpinUp, ©, p, w);
+ drawPrimitive(pe, ©, p, w);
}
if (spin->subControls & SC_SpinBoxDown) {
copy.subControls = SC_SpinBoxDown;
case PE_IndicatorArrowUp:
case PE_IndicatorArrowDown:
case PE_IndicatorSpinUp:
- case PE_IndicatorSpinDown: {
+ case PE_IndicatorSpinDown:
+ case PE_IndicatorSpinPlus:
+ case PE_IndicatorSpinMinus: {
QRect rect = opt->rect;
QColor pen, brush;
if ( opt->state & State_Enabled ) {
pen = opt->palette.mid().color();
brush = pen;
}
- Style_Tools::drawArrow( pe, p, rect, pen, brush );
+ if ( pe == PE_IndicatorSpinPlus || pe == PE_IndicatorSpinMinus )
+ Style_Tools::drawSign( pe, p, rect, pen, brush );
+ else
+ Style_Tools::drawArrow( pe, p, rect, pen, brush );
break;
}
case PE_IndicatorCheckBox: {
p->restore();
}
+void Style_Tools::drawSign( QStyle::PrimitiveElement type, QPainter* p, const QRect& r,
+ const QColor& pen, const QColor& brush )
+{
+ p->save();
+ QPainterPath sign;
+ int x = r.x(), y = r.y(), w = r.right()-x, h = r.bottom()-y;
+ int x11 = 0, x12 = 0, y11 = 0, y12 = 0;
+ int aDelta = qMin( (int)(w/3.5), (int)(h/3.5) );
+ int deltaX = aDelta, deltaY = aDelta;
+ QLineF line( 0, 0, 1, 0 );
+ int xc = r.center().x(), yc = r.center().y();
+ p->translate( xc, yc );
+ bool correct = false;
+ switch( type ) {
+ case QStyle::PE_IndicatorSpinMinus:
+ correct = true;
+ case QStyle::PE_IndicatorSpinPlus: {
+ aDelta = (int)(deltaY/2);
+ if ( correct ) {
+ aDelta = -aDelta;
+ deltaY = -deltaY;
+ }
+ if ( correct )
+ sign.moveTo( deltaY/2, -aDelta/2-(deltaY/2-aDelta/3) );
+ else {
+ sign.moveTo( aDelta/3, -aDelta/2 );
+ sign.lineTo( aDelta/3, -aDelta/2-(deltaY/2-aDelta/3) );
+ sign.lineTo( deltaY/2, -aDelta/2-(deltaY/2-aDelta/3) );
+ }
+
+ sign.lineTo( deltaY/2, -aDelta/2-(deltaY/2-aDelta/3)-2*aDelta/3 );
+
+ if ( !correct ) {
+ sign.lineTo( aDelta/3, -aDelta/2-(deltaY/2-aDelta/3)-2*aDelta/3 );
+ sign.lineTo( aDelta/3, -aDelta/2-deltaY );
+ sign.lineTo( -aDelta/3, -aDelta/2-deltaY );
+ sign.lineTo( -aDelta/3, -aDelta/2-(deltaY/2-aDelta/3)-2*aDelta/3 );
+ }
+
+ sign.lineTo( -deltaY/2, -aDelta/2-(deltaY/2-aDelta/3)-2*aDelta/3 );
+ sign.lineTo( -deltaY/2, -aDelta/2-(deltaY/2-aDelta/3) );
+
+ if ( correct )
+ sign.lineTo( deltaY/2, -aDelta/2-(deltaY/2-aDelta/3) );
+ else {
+ sign.lineTo( -aDelta/3, -aDelta/2-(deltaY/2-aDelta/3) );
+ sign.lineTo( -aDelta/3, -aDelta/2 );
+ sign.lineTo( aDelta/3, -aDelta/2);
+ }
+
+ if ( correct )
+ deltaX = -deltaX;
+ x11 = -deltaX, y11 = -deltaY, x12 = deltaX, y12 = 0;
+ break;
+ }
+ default:
+ p->restore();
+ return;
+ }
+ p->setPen( pen );
+ p->setBrush( brush );
+
+ QLinearGradient gr( x11, y11, x12, y12 );
+ gr.setColorAt( 0.0, pen ); // grayer
+ gr.setColorAt( 1.0, brush); // lighter
+ p->fillPath( sign, gr );
+ p->strokePath( sign, QPen( pen, Qt::SolidLine ) );
+
+ p->restore();
+}
+
QPainterPath Style_Tools::tabRect( QPainter* p, const QRect& r, const int position, const double rad,
const double delta, const QColor& light, const QColor& dark,
const QColor& border_top, const QColor& border_bot,
const QColor&, const int = 255 );
static void drawArrow( QStyle::PrimitiveElement, QPainter*, const QRect&,
const QColor&, const QColor& );
+ static void drawSign( QStyle::PrimitiveElement, QPainter*, const QRect&,
+ const QColor&, const QColor& );
static QPainterPath tabRect( QPainter*, const QRect&, const int, const double,
const double, const QColor&, const QColor&,
const QColor&, const QColor&,