void QWindowsStyle::drawArrow( QPainter *p, ArrowType type, bool down, int x, int y, int w, int h, const QColorGroup &g, bool enabled, const QBrush *fill ) { QPointArray a; // arrow polygon switch ( type ) { case UpArrow: a.setPoints( 7, -4,1, 2,1, -3,0, 1,0, -2,-1, 0,-1, -1,-2 ); break; case DownArrow: a.setPoints( 7, -4,-2, 2,-2, -3,-1, 1,-1, -2,0, 0,0, -1,1 ); break; case LeftArrow: a.setPoints( 7, 1,-3, 1,3, 0,-2, 0,2, -1,-1, -1,1, -2,0 ); break; case RightArrow: a.setPoints( 7, -1,-3, -1,3, 0,-2, 0,2, 1,-1, 1,1, 2,0 ); break; } if ( a.isNull() ) return; if ( down ) { x++; y++; } QPen savePen = p->pen(); // save current pen if (down) p->setBrushOrigin(p->brushOrigin() + QPoint(1,1)); if ( fill ) p->fillRect( x, y, w, h, *fill ); if (down) p->setBrushOrigin(p->brushOrigin() - QPoint(1,1)); if ( enabled ) { a.translate( x+w/2, y+h/2 ); p->setPen( g.buttonText() ); p->drawLineSegments( a, 0, 3 ); // draw arrow p->drawPoint( a[6] ); } else { a.translate( x+w/2+1, y+h/2+1 ); p->setPen( g.light() ); p->drawLineSegments( a, 0, 3 ); // draw arrow p->drawPoint( a[6] ); a.translate( -1, -1 ); p->setPen( g.mid() ); p->drawLineSegments( a, 0, 3 ); // draw arrow p->drawPoint( a[6] ); } p->setPen( savePen ); // restore pen }
static void qDrawWinArrow( QPainter *p, Qt::ArrowType type, bool down, int x, int y, int w, int h, const QColorGroup &g, bool enabled ) { QPointArray a; // arrow polygon switch ( type ) { case Qt::UpArrow: a.setPoints( 7, -3,1, 3,1, -2,0, 2,0, -1,-1, 1,-1, 0,-2 ); break; case Qt::DownArrow: a.setPoints( 7, -3,-1, 3,-1, -2,0, 2,0, -1,1, 1,1, 0,2 ); break; case Qt::LeftArrow: a.setPoints( 7, 1,-3, 1,3, 0,-2, 0,2, -1,-1, -1,1, -2,0 ); break; case Qt::RightArrow: a.setPoints( 7, -1,-3, -1,3, 0,-2, 0,2, 1,-1, 1,1, 2,0 ); break; } if ( a.isNull() ) return; if ( down ) { x++; y++; } QPen savePen = p->pen(); // save current pen if (down) p->setBrushOrigin(p->brushOrigin() + QPoint(1,1)); p->fillRect( x, y, w, h, g.brush( QColorGroup::Button ) ); if (down) p->setBrushOrigin(p->brushOrigin() - QPoint(1,1)); if ( enabled ) { a.translate( x+w/2, y+h/2 ); p->setPen( g.foreground() ); p->drawLineSegments( a, 0, 3 ); // draw arrow p->drawPoint( a[6] ); } else { a.translate( x+w/2+1, y+h/2+1 ); p->setPen( g.light() ); p->drawLineSegments( a, 0, 3 ); // draw arrow p->drawPoint( a[6] ); a.translate( -1, -1 ); p->setPen( g.mid() ); p->drawLineSegments( a, 0, 3 ); // draw arrow p->drawPoint( a[6] ); } p->setPen( savePen ); // restore pen }