qwt, how to fill area above a curve with color?



  • Hi all,
    Colud aomeone help in qwt fillCurve using?
    I try to fill the curve below and over the baseline with different color. I try to use the code that I found and for clipping different regions it's ok.
    But I'm not been able to fill it with different color could someone help me. I try with setBrush(...) but nothing happen.
    Thanks miky.

    @
    void Curve::fillCurve(QPainter *painter,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    const QRectF & canvasRect, QPolygonF & polygon) const
    {
    painter->save();
    QBrush *brush1 = new QBrush (Qt::green, Qt::SolidPattern);
    setBrush(*brush1);
    painter->setClipRect(0,yMap.transform(baseline()),1000,1000,
    Qt::ReplaceClip);
    // QwtPlotCurve::fillCurve(painter, xMap, yMap, canvasRect, polygon);

    painter->setClipRect(0,0,1000,yMap.transform(baseline()),
                         Qt::ReplaceClip);
    QwtPlotCurve::fillCurve(painter, xMap, yMap, canvasRect, polygon);
    painter->restore();
    

    }@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.