本文整理汇总了C++中QCPGraph::property方法的典型用法代码示例。如果您正苦于以下问题:C++ QCPGraph::property方法的具体用法?C++ QCPGraph::property怎么用?C++ QCPGraph::property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCPGraph
的用法示例。
在下文中一共展示了QCPGraph::property方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pointInfo
void DataExplorer::pointInfo(QMouseEvent *event)
{
QCPAbstractPlottable *plottable = ui->runPlot->plottableAt(event->localPos());
if (!plottable) return;
double x = ui->runPlot->xAxis->pixelToCoord(event->localPos().x());
QToolTip::hideText();
QCPGraph *graph = qobject_cast<QCPGraph*>(plottable);
if (graph) {
double key = 0;
double value = 0;
bool ok = false;
double m = std::numeric_limits<double>::max();
for (QCPData data : graph->data()->values()) {
double d = qAbs(x - data.key);
if(d < m) {
key = data.key;
value = data.value;
ok = true;
m = d;
}
}
if (!ok) return;
QToolTip::showText(event->globalPos(),
tr("<center><b>%L1</b><br/>%L2 %[email protected] %L4s</center>").
arg(graph->name().isEmpty() ? "..." : graph->name()).
arg(value).arg(graph->property("unit").toString()).
arg(key),
ui->runPlot, ui->runPlot->rect());
return;
}
QCPStatisticalBox *graphBox = qobject_cast<QCPStatisticalBox*>(plottable);
if (graphBox) {
QToolTip::showText(event->globalPos(),
tr("<center><b>%L1</b><br/></center>Max: %2<br/>Upper: %3<br/>Median: %4<br/>Lower: %5<br/>Min: %6<br/>StdDev: %7<br/>Avg: %8<br/>Avg Time: %9").
arg(graphBox->name().isEmpty() ? "..." : graphBox->name()).
arg(graphBox->maximum()).arg(graphBox->upperQuartile()).arg(graphBox->median()).
arg(graphBox->lowerQuartile()).arg(graphBox->minimum()).
arg(graphBox->property("StdDev").toDouble()).arg(graphBox->property("avg").toDouble()).
arg(graphBox->property("avgTime").toDouble()),
ui->runPlot, ui->runPlot->rect());
}
}