Example #1
0
/*!
  \return List of all attached plot items of a specific type.
  \param rtti See QwtPlotItem::RttiValues
  \sa QwtPlotItem::rtti()
*/
QwtPlotItemList QwtPlotDict::itemList( int rtti ) const
{
    if ( rtti == QwtPlotItem::Rtti_PlotItem )
        return d_data->itemList;

    QwtPlotItemList items;

    PrivateData::ItemList list = d_data->itemList;
    for ( QwtPlotItemIterator it = list.begin(); it != list.end(); ++it )
    {
        QwtPlotItem *item = *it;
        if ( item->rtti() == rtti )
            items += item;
    }

    return items;
}
Example #2
0
/*!
   Detach items from the dictionary

   \param rtti In case of QwtPolarItem::Rtti_PlotItem detach all items
               otherwise only those items of the type rtti.
   \param autoDelete If true, delete all detached items
*/
void QwtPolarItemDict::detachItems( int rtti, bool autoDelete )
{
  PrivateData::ItemList list = d_data->itemList;
  QwtPolarItemIterator it = list.begin();
  while ( it != list.end() )
  {
    QwtPolarItem *item = *it;

    ++it; // increment before removing item from the list

    if ( rtti == QwtPolarItem::Rtti_PolarItem || item->rtti() == rtti )
    {
      item->attach( NULL );
      if ( autoDelete )
        delete item;
    }
  }
}