Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

void QPainter::drawConvexPolygon ( const QPointF points,
int  pointCount 
) [inherited]

Draws the convex polygon defined by the first pointCount points in the array points using the current pen.

100% qpainter-polygon.png doc/src/snippets/code/src_gui_painting_qpainter.cpp 15

The first point is implicitly connected to the last point, and the polygon is filled with the current brush(). If the supplied polygon is not convex, i.e. it contains at least one angle larger than 180 degrees, the results are undefined.

On some platforms (e.g. X11), the drawConvexPolygon() function can be faster than the drawPolygon() function.

See also:
drawPolygon(), drawPolyline(), {The Coordinate System}

Definition at line 5111 of file qpainter.cpp.

References QPainterPath::closeSubpath(), QPainterPath::lineTo(), and QPainterPath::setFillRule().

Referenced by QPainter::drawConvexPolygon(), ShapedClock::paintEvent(), WorldTimeClock::paintEvent(), and AnalogClock::paintEvent().

{
#ifdef QT_DEBUG_DRAW
    if (qt_show_painter_debug_output)
        printf("QPainter::drawConvexPolygon(), count=%d\n", pointCount);
#endif

    Q_D(QPainter);

    if (!d->engine || pointCount < 2)
        return;

    if (d->extended) {
        d->extended->drawPolygon(points, pointCount, QPaintEngine::ConvexMode);
        return;
    }

    d->updateState(d->state);

    uint emulationSpecifier = d->state->emulationSpecifier;

    if (emulationSpecifier) {
        QPainterPath polygonPath(points[0]);
        for (int i=1; i<pointCount; ++i)
            polygonPath.lineTo(points[i]);
        polygonPath.closeSubpath();
        polygonPath.setFillRule(Qt::WindingFill);
        d->draw_helper(polygonPath);
        return;
    }

    d->engine->drawPolygon(points, pointCount, QPaintEngine::ConvexMode);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index