Public Member Functions

QwtGuardedPainter Class Reference

List of all members.

Public Member Functions

 ~QwtGuardedPainter ()
QPainter * begin (QwtPlotCanvas *canvas)
void end ()
virtual bool eventFilter (QObject *, QEvent *event)

Detailed Description

Definition at line 77 of file qwt_plot_curve.cpp.


Constructor & Destructor Documentation

QwtGuardedPainter::~QwtGuardedPainter (  ) [inline]

Definition at line 80 of file qwt_plot_curve.cpp.

References end().

    {
        end();
    }

Member Function Documentation

QPainter* QwtGuardedPainter::begin ( QwtPlotCanvas canvas ) [inline]

Definition at line 85 of file qwt_plot_curve.cpp.

Referenced by QwtPlotCurve::draw().

    {
        _canvas = canvas;

        QMap<QwtPlotCanvas *, QPainter *>::iterator it = _map.find(_canvas);
        if ( it == _map.end() )
        {
            QPainter *painter = new QPainter(_canvas);
            painter->setClipping(true);
            painter->setClipRect(_canvas->contentsRect());

            it = _map.insert(_canvas, painter);
            _canvas->installEventFilter(this);
        }
#if QT_VERSION < 0x040000
        return it.data();
#else
        return it.value();
#endif
    }
void QwtGuardedPainter::end (  ) [inline]

Definition at line 106 of file qwt_plot_curve.cpp.

Referenced by eventFilter(), and ~QwtGuardedPainter().

    {
        if ( _canvas )
        {
            QMap<QwtPlotCanvas *, QPainter *>::iterator it = _map.find(_canvas);
            if ( it != _map.end() )
            {
                _canvas->removeEventFilter(this);

#if QT_VERSION < 0x040000
                delete it.data();
#else
                delete it.value();
#endif
                _map.erase(it);
            }
        }
    }
virtual bool QwtGuardedPainter::eventFilter ( QObject *  ,
QEvent *  event 
) [inline, virtual]

Definition at line 125 of file qwt_plot_curve.cpp.

References end().

    {
        if ( event->type() == QEvent::Paint )
            end();

        return false;
    }

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines