Example #1
0
void Plot::printCanvas(QPainter *painter, const QRect &canvasRect,
                       const QwtArray<QwtDiMap> &map, const QwtPlotPrintFilter &pfilter) const
{
    const QwtPlotCanvas* plotCanvas=canvas();
    QRect rect=canvasRect;
    int w=plotCanvas->lineWidth();

    if (w>0)
    {
        QPalette pal =plotCanvas->palette();
        QColor color=pal.color(QPalette::Active, QColorGroup::Foreground);

        painter->save();
        painter->setPen (QPen(color,w,Qt::SolidLine));

        if (w == 1 && ticksType[QwtPlot::xBottom] == Plot::Out)
            rect.setHeight(canvasRect.height() + 1);

        QwtPainter::drawRect(painter, rect.x(), rect.y(), rect.width(), rect.height());
        painter->restore();
    }

    painter->setClipping(TRUE);
    rect = QRect(canvasRect.x()+1, canvasRect.y()+1, canvasRect.width(), canvasRect.height()-1);
    QwtPainter::setClipRect(painter, rect);

    drawCanvasItems(painter, canvasRect, map, pfilter);
}
Example #2
0
void QwtPlot::drawCanvas(QPainter *painter)
{
    QwtArray<QwtDiMap> map(axisCnt);
    for ( int axis = 0; axis < axisCnt; axis++ )
        map[axis] = canvasMap(axis);

    drawCanvasItems(painter, 
        d_canvas->contentsRect(), map, QwtPlotPrintFilter());
}
void QwtPlot::printCanvas(QPainter *painter, const QRect &canvasRect,
    const QwtArray<QwtDiMap> &map, const QwtPlotPrintFilter &pfilter) const
{
    if ( pfilter.options() & QwtPlotPrintFilter::PrintCanvasBackground )
    {
        QwtPainter::fillRect(painter, QRect(canvasRect.x(), canvasRect.y(), 
            canvasRect.width() - 1, canvasRect.height() - 1),
            canvasBackground());
    }
    else
        QwtPainter::drawRect(painter, canvasRect.x() - 1, canvasRect.y() - 1,
            canvasRect.width() + 1, canvasRect.height() + 1);

    painter->setClipping(TRUE);
    QwtPainter::setClipRect(painter, canvasRect);

    drawCanvasItems(painter, canvasRect, map, pfilter);
}