[4271] | 1 | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
---|
| 2 | * Qwt Widget Library
|
---|
| 3 | * Copyright (C) 1997 Josef Wilgen
|
---|
| 4 | * Copyright (C) 2002 Uwe Rathmann
|
---|
| 5 | *
|
---|
| 6 | * This library is free software; you can redistribute it and/or
|
---|
| 7 | * modify it under the terms of the Qwt License, Version 1.0
|
---|
| 8 | *****************************************************************************/
|
---|
| 9 |
|
---|
| 10 | #ifndef QWT_PLOT_DIRECT_PAINTER_H
|
---|
| 11 | #define QWT_PLOT_DIRECT_PAINTER_H
|
---|
| 12 |
|
---|
| 13 | #include "qwt_global.h"
|
---|
| 14 | #include <qobject.h>
|
---|
| 15 |
|
---|
| 16 | class QRegion;
|
---|
| 17 | class QwtPlotAbstractSeriesItem;
|
---|
| 18 |
|
---|
| 19 | /*!
|
---|
| 20 | \brief Painter object trying to paint incrementally
|
---|
| 21 |
|
---|
| 22 | Often applications want to display samples while they are
|
---|
| 23 | collected. When there are too many samples complete replots
|
---|
| 24 | will be expensive to be processed in a collection cycle.
|
---|
| 25 |
|
---|
| 26 | QwtPlotDirectPainter offers an API to paint
|
---|
| 27 | subsets ( f.e all additions points ) without erasing/repainting
|
---|
| 28 | the plot canvas.
|
---|
| 29 |
|
---|
| 30 | On certain environments it might be important to calculate a proper
|
---|
| 31 | clip region before painting. F.e. for Qt Embedded only the clipped part
|
---|
| 32 | of the backing store will be copied to a ( maybe unaccelerated )
|
---|
| 33 | frame buffer.
|
---|
| 34 |
|
---|
| 35 | \warning Incremental painting will only help when no replot is triggered
|
---|
| 36 | by another operation ( like changing scales ) and nothing needs
|
---|
| 37 | to be erased.
|
---|
| 38 | */
|
---|
| 39 | class QWT_EXPORT QwtPlotDirectPainter: public QObject
|
---|
| 40 | {
|
---|
| 41 | public:
|
---|
| 42 | /*!
|
---|
| 43 | \brief Paint attributes
|
---|
| 44 | \sa setAttribute(), testAttribute(), drawSeries()
|
---|
| 45 | */
|
---|
| 46 | enum Attribute
|
---|
| 47 | {
|
---|
| 48 | /*!
|
---|
| 49 | Initializing a QPainter is an expensive operation.
|
---|
| 50 | When AtomicPainter is set each call of drawSeries() opens/closes
|
---|
| 51 | a temporary QPainter. Otherwise QwtPlotDirectPainter tries to
|
---|
| 52 | use the same QPainter as long as possible.
|
---|
| 53 | */
|
---|
| 54 | AtomicPainter = 0x01,
|
---|
| 55 |
|
---|
| 56 | /*!
|
---|
| 57 | When FullRepaint is set the plot canvas is explicitely repainted
|
---|
| 58 | after the samples have been rendered.
|
---|
| 59 | */
|
---|
| 60 | FullRepaint = 0x02,
|
---|
| 61 |
|
---|
| 62 | /*!
|
---|
| 63 | When QwtPlotCanvas::BackingStore is enabled the painter
|
---|
| 64 | has to paint to the backing store and the widget. In certain
|
---|
| 65 | situations/environments it might be faster to paint to
|
---|
| 66 | the backing store only and then copy the backingstore to the canvas.
|
---|
| 67 | This flag can also be useful for settings, where Qt fills the
|
---|
| 68 | the clip region with the widget background.
|
---|
| 69 | */
|
---|
| 70 | CopyBackingStore = 0x04
|
---|
| 71 | };
|
---|
| 72 |
|
---|
| 73 | //! Paint attributes
|
---|
| 74 | typedef QFlags<Attribute> Attributes;
|
---|
| 75 |
|
---|
| 76 | QwtPlotDirectPainter( QObject *parent = NULL );
|
---|
| 77 | virtual ~QwtPlotDirectPainter();
|
---|
| 78 |
|
---|
| 79 | void setAttribute( Attribute, bool on );
|
---|
| 80 | bool testAttribute( Attribute ) const;
|
---|
| 81 |
|
---|
| 82 | void setClipping( bool );
|
---|
| 83 | bool hasClipping() const;
|
---|
| 84 |
|
---|
| 85 | void setClipRegion( const QRegion & );
|
---|
| 86 | QRegion clipRegion() const;
|
---|
| 87 |
|
---|
| 88 | void drawSeries( QwtPlotAbstractSeriesItem *, int from, int to );
|
---|
| 89 | void reset();
|
---|
| 90 |
|
---|
| 91 | virtual bool eventFilter( QObject *, QEvent * );
|
---|
| 92 |
|
---|
| 93 | private:
|
---|
| 94 | class PrivateData;
|
---|
| 95 | PrivateData *d_data;
|
---|
| 96 | };
|
---|
| 97 |
|
---|
| 98 | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotDirectPainter::Attributes )
|
---|
| 99 |
|
---|
| 100 | #endif
|
---|