本文整理汇总了C++中QwtLegend::find方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtLegend::find方法的具体用法?C++ QwtLegend::find怎么用?C++ QwtLegend::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtLegend
的用法示例。
在下文中一共展示了QwtLegend::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void GenericHistogramView::init()
{
this->setMouseTracking(true); //Switch on mouse tracking (no need to press button)
_qwtPlot->setTitle("Histogram");
_qwtPlot->setCanvasBackground(QColor(Qt::gray));
_qwtPlot->plotLayout()->setAlignCanvasToScales(true);
_qwtPlot->setAxisTitle(QwtPlot::yLeft, "Number of specimen");
_qwtPlot->setAxisTitle(QwtPlot::xBottom, "Pixel value");
QwtLegend* legend = new QwtLegend();
legend->setItemMode(QwtLegend::CheckableItem);
_qwtPlot->insertLegend(legend, QwtPlot::RightLegend);
populate();
_qwtPlot->canvas()->setMouseTracking(true);
if(_horizontal)
_principalPicker = new HistogramPicker(QwtPlotPicker::HLineRubberBand, QwtPicker::AlwaysOn, _qwtPlot->canvas());
else
_principalPicker = new HistogramPicker(QwtPlotPicker::VLineRubberBand, QwtPicker::AlwaysOn, _qwtPlot->canvas());
_principalPicker->setStateMachine(new QwtPickerDragPointMachine());
_principalPicker->setTrackerPen(QColor(Qt::white));
_principalPicker->setRubberBandPen(QColor(Qt::yellow));
_leftPicker = new HistogramPicker(_qwtPlot->canvas());
_leftPicker->setStateMachine(new QwtPickerDragPointMachine());
_rightPicker = new HistogramPicker(_qwtPlot->canvas());
_rightPicker->setStateMachine(new QwtPickerDragPointMachine());
_rightPicker->setRubberBand(QwtPlotPicker::VLineRubberBand);
_rightPicker->setRubberBandPen(QColor(Qt::yellow));
_rightPicker->setMousePattern(QwtPicker::MouseSelect1, Qt::RightButton);
connect(_qwtPlot, SIGNAL(legendChecked(QwtPlotItem*, bool)), this, SLOT(showItem(QwtPlotItem*, bool)));
connect(_rightPicker, SIGNAL(selected(const QPointF&)), this, SLOT(rightClick(const QPointF&)));
connect(_leftPicker, SIGNAL(selected(const QPointF&)), this, SLOT(leftClick(const QPointF&)));
connect(_principalPicker, SIGNAL(moved(const QPointF&)), this, SLOT(move(const QPointF&)));
_qwtPlot->replot(); // creating the legend items
QwtPlotItemList items = _qwtPlot->itemList(QwtPlotItem::Rtti_PlotHistogram);
for(int i = 0; i < items.size(); i++)
{
QwtLegendItem* legendItem = qobject_cast<QwtLegendItem*>(legend->find(items[i]));
if(legendItem)
legendItem->setChecked(true);
items[i]->setVisible(true);
}
_qwtPlot->setAutoReplot(true);
}
示例2: setTooltip
void LineChart::setTooltip(QString t)
{
tooltip = t;
QwtPlot *p = plot();
if (p == NULL)
return;
QwtLegend *l = p->legend();
if (l == NULL)
return;
QwtLegendItem *legendItem = (QwtLegendItem *)l->find(this);
if (legendItem != NULL)
legendItem->setToolTip(tooltip);
}