当前位置: 首页>>代码示例>>C++>>正文


C++ QwtPlotItem类代码示例

本文整理汇总了C++中QwtPlotItem的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotItem类的具体用法?C++ QwtPlotItem怎么用?C++ QwtPlotItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QwtPlotItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: axisWidget

void Plot::removeCurve(int index)
{
	QwtPlotItem *c = d_curves[index];
  	if (!c)
  		return;

  	if (c->rtti() == QwtPlotItem::Rtti_PlotSpectrogram)
  	{
  		Spectrogram *sp = (Spectrogram *)c;
  	    QwtScaleWidget *colorAxis = axisWidget(sp->colorScaleAxis());
  	    if (colorAxis)
  	    	colorAxis->setColorBarEnabled(false);
  	}

	c->detach();
	QwtPlotItem* p = d_curves.take (index);
  // RNT: Making curve_key unique prevents clashes elsewhere
	//--curve_key;
	// MG: This is a rather crude but effective way of delaying the
	// deletion of the curve objects. This is necessary because in
	// a tight loop a curve may not have been completely removed 
	// but the object has been deleted.
	Detacher *detacher = new Detacher(p);
	detacher->deleteLater();
}
开发者ID:trnielsen,项目名称:mantid,代码行数:25,代码来源:Plot.cpp

示例2: showCurveBtn

void CurvesDialog::showCurveBtn(int)
{
	QwtPlotItem *it = d_graph->plotItem(contents->currentRow());
	if (!it)
		return;

    if (it->rtti() == QwtPlotItem::Rtti_PlotSpectrogram)
    {
        btnEditFunction->setEnabled(false);
        btnAssociations->setEnabled(false);
        btnRange->setEnabled(false);
        return;
    }

    PlotCurve *c = (PlotCurve *)it;
	if (c->type() == Graph::Function)
	{
		btnEditFunction->setEnabled(true);
		btnAssociations->setEnabled(false);
		btnRange->setEnabled(false);
		return;
	}

    btnAssociations->setEnabled(true);

    btnRange->setEnabled(true);
	if (c->type() == Graph::ErrorBars)
  		btnRange->setEnabled(false);
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:29,代码来源:CurvesDialog.cpp

示例3: curve

QwtPlotCurve* Plot::curve(int index)
{
    QwtPlotItem *it = d_curves.value(index);
    if (it && it->rtti() != QwtPlotItem::Rtti_PlotSpectrogram)
        return (QwtPlotCurve*)it;
    else
        return 0;
}
开发者ID:trnielsen,项目名称:mantid,代码行数:8,代码来源:Plot.cpp

示例4: legendClicked

void scopePlot::legendClicked(const QVariant &itemInfo, bool on)
{
  QwtPlotItem *plotItem = plW->infoToItem( itemInfo );
  if ( plotItem )
    {
      plotItem->setVisible( on );
      plW->replot();
    }
}
开发者ID:cureton,项目名称:qsstv,代码行数:9,代码来源:scopeplot.cpp

示例5: infoToItem

void Graph::showCurve(const QVariant &itemInfo, bool on, int index )
{
    QwtPlotItem *it = infoToItem(itemInfo);
    if(it)
        it->setVisible(on);

    if(legend())
    {
        QWidget *w = ((QwtLegend*)legend())->legendWidget(itemInfo);
        if(w && w->inherits("QwtLegendLabel"))
            ((QwtLegendLabel*)w)->setChecked(on);
    }

    replot();
}
开发者ID:Tasssadar,项目名称:Lorris,代码行数:15,代码来源:graph.cpp

示例6: getPlotModel

void SAChartDatasViewWidget::onActionPasteTriggered()
{
    SAWaitCursor waitCursor;
    SAPlotDataModel* model = getPlotModel();
    QItemSelectionModel* selModel = ui->tableView->selectionModel();
    if(nullptr == selModel || nullptr == model)
        return;
    //获取当前选择的列
    QModelIndexList selColIndexs = selModel->selectedIndexes();
    //说明只选择了一个单元格
    if(selColIndexs.isEmpty())
    {
        return;
    }
    int col = selColIndexs[0].column();
    int row = selColIndexs[0].row();
    //获取对应的item
    QwtPlotItem* item = model->getItemFromCol(col);
    if(nullptr == item)
        return;
    //获取这个数据在表格里的起始列和终止列
    int startCol,endCol;
    model->getItemColumnRange(item,&startCol,&endCol);
    if(-1 == startCol || -1 == endCol)
        return;

    QList<QStringList> stringClipboardTable;
    getClipboardTextTable(stringClipboardTable);
    SAChart2D* chart = qobject_cast<SAChart2D*>(item->plot());
    if(chart)
    {
        QScopedPointer<SAFigureTablePasteInSeriesCommand> cmd(new SAFigureTablePasteInSeriesCommand(
                    chart
                    ,item
                    ,stringClipboardTable
                    ,row
                    ,col-startCol
                    ,tr("paste in figure chart table")
                    ));
        if(!cmd->isValid())
        {
            return;
        }

        chart->appendCommand(cmd.take());
        model->updateRow();
    }
}
开发者ID:czyt1988,项目名称:sa,代码行数:48,代码来源:SAChartDatasViewWidget.cpp

示例7: numberOfCurves

int LinePlot::numberOfCurves()
{
  /// multiple curves based on units
  const QwtPlotItemList &listPlotItem = m_qwtPlot->itemList();
  QwtPlotItemIterator itPlotItem;
  int curveCount = 0;
  for (itPlotItem = listPlotItem.begin();itPlotItem!=listPlotItem.end();++itPlotItem)
  {
    QwtPlotItem *plotItem = *itPlotItem;
    if ( plotItem->rtti() == QwtPlotItem::Rtti_PlotCurve)
    {
      curveCount++;
    }
  }
  return curveCount;
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:16,代码来源:LinePlot.cpp

示例8: itemList

/*!
  \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;
}
开发者ID:iclosure,项目名称:jdataanalyse,代码行数:22,代码来源:qwt_plot_dict.cpp

示例9: removeCurve

void Plot::removeCurve(int index)
{
	QwtPlotItem *c = d_curves[index];
  	if (!c)
  		return;

  	if (c->rtti() == QwtPlotItem::Rtti_PlotSpectrogram)
  	{
  		Spectrogram *sp = (Spectrogram *)c;
  	    QwtScaleWidget *colorAxis = axisWidget(sp->colorScaleAxis());
  	    if (colorAxis)
  	    	colorAxis->setColorBarEnabled(false);
  	}

	c->detach();
	d_curves.remove (index);
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:17,代码来源:Plot.cpp

示例10: itemList

void QwtPlot::drawItems(QPainter *painter, const QRect &rect, 
        const QwtScaleMap map[axisCnt], 
        const QwtPlotPrintFilter &pfilter) const
{
    const QwtPlotItemList& itmList = itemList();
    for ( QwtPlotItemIterator it = itmList.begin();
        it != itmList.end(); ++it )
    {
        QwtPlotItem *item = *it;
        if ( item && item->isVisible() )
        {
            if ( !(pfilter.options() & QwtPlotPrintFilter::PrintGrid)
                && item->rtti() == QwtPlotItem::Rtti_PlotGrid )
            {
                continue;
            }

            painter->save();

#if QT_VERSION >= 0x040000
            painter->setRenderHint(QPainter::Antialiasing,
                item->testRenderHint(QwtPlotItem::RenderAntialiased) );
#endif

            item->draw(painter, 
                map[item->xAxis()], map[item->yAxis()],
                rect);

            painter->restore();
        }
    }
}
开发者ID:DTUautopilot,项目名称:qgroundcontrol,代码行数:32,代码来源:qwt_plot.cpp

示例11: itemList

void QwtPlot::drawItems( QPainter *painter, const QRectF &canvasRect,
        const QwtScaleMap maps[axisCnt] ) const
{
    const QwtPlotItemList& itmList = itemList();
    for ( QwtPlotItemIterator it = itmList.begin();
        it != itmList.end(); ++it )
    {
        QwtPlotItem *item = *it;
        if ( item && item->isVisible() )
        {
            painter->save();

            painter->setRenderHint( QPainter::Antialiasing,
                item->testRenderHint( QwtPlotItem::RenderAntialiased ) );
            painter->setRenderHint( QPainter::HighQualityAntialiasing,
                item->testRenderHint( QwtPlotItem::RenderAntialiased ) );

            item->draw( painter,
                maps[item->xAxis()], maps[item->yAxis()],
                canvasRect );

            painter->restore();
        }
    }
}
开发者ID:AleksandraPalosz,项目名称:ecg_holter,代码行数:25,代码来源:qwt_plot.cpp

示例12: canvasMap

/**
 * Returns the index of the closest curve to a point on the canvas.
 * Also returns index of the nearest data point on that curve.
 * @param xpos :: x coordinate of a point on the canvas in pixels.
 * @param ypos :: y coordinate of a point on the canvas in pixels.
 * @param dist :: ?
 * @param point :: Output index of the nearest data point to the point with coordinates (xpos,ypos)
 */
int Plot::closestCurve(int xpos, int ypos, int &dist, int &point)
{
	QwtScaleMap map[QwtPlot::axisCnt];
	for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
		map[axis] = canvasMap(axis);

  double dmin = std::numeric_limits<double>::max();
	int key = -1;
	for (QMap<int, QwtPlotItem *>::iterator iter = d_curves.begin(); iter != d_curves.end(); ++iter )
	{
		QwtPlotItem *item = (QwtPlotItem *)iter.data();
		if (!item)
			continue;

    if(item->rtti() != QwtPlotItem::Rtti_PlotSpectrogram)
    {
      PlotCurve *c = (PlotCurve *)item;
      DataCurve *dc = dynamic_cast<DataCurve *>(item);
      if (dc)
      {
        if (c->type() != Graph::Function && dc->hasLabels() &&
          dc->selectedLabels(QPoint(xpos, ypos))){
            dist = 0;
            return iter.key();
        } else
          dc->setLabelsSelected(false);
      }

      for (int i=0; i<c->dataSize(); i++)
      {
        double cx = map[c->xAxis()].xTransform(c->x(i)) - double(xpos);
        double cy = map[c->yAxis()].xTransform(c->y(i)) - double(ypos);
        double f = qwtSqr(cx) + qwtSqr(cy);
        if (f < dmin && c->type() != Graph::ErrorBars)
        {
          dmin = f;
          key = iter.key();
          point = i;
        }
      }
    }
  }
	dist = static_cast<int>(sqrt(dmin));
	return key;
}
开发者ID:trnielsen,项目名称:mantid,代码行数:53,代码来源:Plot.cpp

示例13: while

/*!
   Detach items from the dictionary

   \param rtti In case of QwtPlotItem::Rtti_PlotItem detach all items
               otherwise only those items of the type rtti.
   \param autoDelete If true, delete all detached items
*/
void QwtPlotDict::detachItems( int rtti, bool autoDelete )
{
    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;
        }
    }
}
开发者ID:iclosure,项目名称:jdataanalyse,代码行数:25,代码来源:qwt_plot_dict.cpp

示例14: insertLegend

void Graph::initLegend()
{
    QwtLegend *legend = new QwtLegend;
    legend->setDefaultItemMode(QwtLegendData::Checkable);
    insertLegend(legend, QwtPlot::BottomLegend);

    connect(legend, SIGNAL(checked(QVariant,bool,int)), SLOT(showCurve(QVariant,bool,int)));

    QwtPlotItemList l = this->itemList(QwtPlotItem::Rtti_PlotCurve);
    for(int i = 0; i < l.size(); ++i)
    {
        QwtPlotItem *curve = l[i];
        QVariant info = itemToInfo(curve);
        QWidget *w = legend->legendWidget(info);
        if(w && w->inherits("QwtLegendLabel"))
            ((QwtLegendLabel*)w)->setChecked(curve->isVisible());
    }
}
开发者ID:Tasssadar,项目名称:Lorris,代码行数:18,代码来源:graph.cpp

示例15: setLineThickness

void LinePlot::setLineThickness(const int &width)
{
  const QwtPlotItemList &listPlotItem = m_qwtPlot->itemList();
  QwtPlotItemIterator itPlotItem;
  for (itPlotItem = listPlotItem.begin();itPlotItem!=listPlotItem.end();++itPlotItem)
  {
    QwtPlotItem *plotItem = *itPlotItem;
    if ( plotItem->rtti() == QwtPlotItem::Rtti_PlotCurve)
    {
      QwtPlotCurve *curve = (QwtPlotCurve *) plotItem;
      QPen pen(curve->pen()); 
      pen.setWidth(width);
      curve->setPen(pen);
    }
  }
  m_qwtPlot->replot();

}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:18,代码来源:LinePlot.cpp


注:本文中的QwtPlotItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。