QwtPlotItem

来源:互联网 发布:狸窝ppt转换器软件 编辑:程序博客网 时间:2024/05/20 13:09

1、CpuPieMarker ----------------->QwtPlotItem

setRenderHint( QwtPlotItem::RenderAntialiased, TRUE );     //抗锯齿

2、Background      ---------------->QwtPlotItem

class Background: public QwtPlotItem
{
public:
    Background()
    {
        setZ( 0.0 );
    }


    virtual int rtti() const
    {
        return QwtPlotItem::Rtti_PlotUserItem;
    }


    virtual void draw( QPainter *painter,
        const QwtScaleMap &, const QwtScaleMap &yMap,
        const QRectF &canvasRect ) const
    {
        QColor c( Qt::white );
        QRectF r = canvasRect;


        for ( int i = 110; i > 0; i -= 10 )
        {
            r.setBottom( yMap.transform( i - 10 ) );
            r.setTop( yMap.transform( i ) );
            painter->fillRect( r, c );


            c = c.dark( 110 );
        }
    }
};