A dictionary for plot items. More...
#include <qwt_plot_dict.h>
Classes | |
class | PrivateData |
Public Member Functions | |
QwtPlotDict () | |
~QwtPlotDict () | |
void | setAutoDelete (bool) |
bool | autoDelete () const |
const QwtPlotItemList & | itemList () const |
A QwtPlotItemList of all attached plot items. | |
void | detachItems (int rtti=QwtPlotItem::Rtti_PlotItem, bool autoDelete=true) |
Friends | |
class | QwtPlotItem |
A dictionary for plot items.
QwtPlotDict organizes plot items in increasing z-order. If autoDelete() is enabled, all attached items will be deleted in the destructor of the dictionary.
Definition at line 42 of file qwt_plot_dict.h.
QwtPlotDict::QwtPlotDict | ( | ) | [explicit] |
Constructor
Auto deletion is enabled.
Definition at line 94 of file qwt_plot_dict.cpp.
References QwtPlotDict::PrivateData::autoDelete.
{ d_data = new QwtPlotDict::PrivateData; d_data->autoDelete = true; }
QwtPlotDict::~QwtPlotDict | ( | ) |
Destructor
If autoDelete is on, all attached items will be deleted
Definition at line 106 of file qwt_plot_dict.cpp.
References QwtPlotDict::PrivateData::autoDelete, detachItems(), and QwtPlotItem::Rtti_PlotItem.
{ detachItems(QwtPlotItem::Rtti_PlotItem, d_data->autoDelete); delete d_data; }
bool QwtPlotDict::autoDelete | ( | ) | const |
Definition at line 129 of file qwt_plot_dict.cpp.
References QwtPlotDict::PrivateData::autoDelete.
Referenced by setAutoDelete(), and QwtPlot::~QwtPlot().
{ return d_data->autoDelete; }
void QwtPlotDict::detachItems | ( | int | rtti = QwtPlotItem::Rtti_PlotItem , |
bool | autoDelete = true |
||
) |
Detach items from the dictionary
rtti | In case of QwtPlotItem::Rtti_PlotItem detach all items otherwise only those items of the type rtti. |
autoDelete | If true, delete all detached items |
Definition at line 161 of file qwt_plot_dict.cpp.
References QwtPlotItem::attach(), QwtPlotDict::PrivateData::itemList, QwtPlotItem::rtti(), and QwtPlotItem::Rtti_PlotItem.
Referenced by QwtPlot::clear(), QwtPlot::~QwtPlot(), and ~QwtPlotDict().
{ PrivateData::ItemList list = d_data->itemList; QwtPlotItemIterator it = list.begin(); while ( it != list.end() ) { QwtPlotItem *item = *it; ++it; // increment before removing item from the list if ( rtti == QwtPlotItem::Rtti_PlotItem || item->rtti() == rtti ) { item->attach(NULL); if ( autoDelete ) delete item; } } }
const QwtPlotItemList & QwtPlotDict::itemList | ( | ) | const |
A QwtPlotItemList of all attached plot items.
Use caution when iterating these lists, as removing/detaching an item will invalidate the iterator. Instead you can place pointers to objects to be removed in a removal list, and traverse that list later.
Definition at line 186 of file qwt_plot_dict.cpp.
References QwtPlotDict::PrivateData::itemList.
Referenced by QwtPlotPrintFilter::apply(), QwtPlot::drawItems(), QwtPlot::insertLegend(), QwtPlotPrintFilter::reset(), and QwtPlot::updateAxes().
{ return d_data->itemList; }
void QwtPlotDict::setAutoDelete | ( | bool | autoDelete ) |
En/Disable Auto deletion
If Auto deletion is on all attached plot items will be deleted in the destructor of QwtPlotDict. The default value is on.
Definition at line 120 of file qwt_plot_dict.cpp.
References autoDelete(), and QwtPlotDict::PrivateData::autoDelete.
{ d_data->autoDelete = autoDelete; }
friend class QwtPlotItem [friend] |
Definition at line 57 of file qwt_plot_dict.h.