本文整理汇总了C++中QCustomPlot::selectedGraphs方法的典型用法代码示例。如果您正苦于以下问题:C++ QCustomPlot::selectedGraphs方法的具体用法?C++ QCustomPlot::selectedGraphs怎么用?C++ QCustomPlot::selectedGraphs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCustomPlot
的用法示例。
在下文中一共展示了QCustomPlot::selectedGraphs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeSelectedGraph
void viewGVpropertieslayout::removeSelectedGraph()
{
// first get a pointer to the current plot!
QCustomPlot * currPlot = (QCustomPlot *) currentSubWindow->widget();
if (currPlot->selectedGraphs().size() > 0)
{
currPlot->removeGraph(currPlot->selectedGraphs().first());
currPlot->replot();
}
}
示例2: contextMenuRequest
void viewGVpropertieslayout::contextMenuRequest(QPoint pos)
{
// first get a pointer to the current plot!
QCustomPlot * currPlot = (QCustomPlot *) currentSubWindow->widget();
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
if (currPlot->legend->selectTest(pos, false) >= 0) // context menu on legend requested
{
/*menu->addAction("Move to top left", this, SLOT(moveLegend()))->setData((int)(Qt::AlignTop|Qt::AlignLeft));
menu->addAction("Move to top center", this, SLOT(moveLegend()))->setData((int)(Qt::AlignTop|Qt::AlignHCenter));
menu->addAction("Move to top right", this, SLOT(moveLegend()))->setData((int)(Qt::AlignTop|Qt::AlignRight));
menu->addAction("Move to bottom right", this, SLOT(moveLegend()))->setData((int)(Qt::AlignBottom|Qt::AlignRight));
menu->addAction("Move to bottom left", this, SLOT(moveLegend()))->setData((int)(Qt::AlignBottom|Qt::AlignLeft));*/
} else if (currPlot->xAxis->selectTest(pos, false) >= 0 || \
currPlot->xAxis2->selectTest(pos, false) >= 0)
{
// enable / disable zoom
if (currPlot->axisRect()->rangeZoom() & Qt::Horizontal)
menu->addAction("Disable zoom on axis", this, SLOT(toggleHorizontalZoom()));
else
menu->addAction("Enable zoom on axis", this, SLOT(toggleHorizontalZoom()));
// enable / diable drag
if (currPlot->axisRect()->rangeDrag() & Qt::Horizontal)
menu->addAction("Disable drag on axis", this, SLOT(toggleHorizontalDrag()));
else
menu->addAction("Enable drag on axis", this, SLOT(toggleHorizontalDrag()));
} else if (currPlot->yAxis->selectTest(pos, false) >= 0 || \
currPlot->yAxis2->selectTest(pos, false) >= 0)
{
// enable / disable zoom
if (currPlot->axisRect()->rangeZoom() & Qt::Vertical)
menu->addAction("Disable zoom on axis", this, SLOT(toggleVerticalZoom()));
else
menu->addAction("Enable zoom on axis", this, SLOT(toggleVerticalZoom()));
// enable / diable drag
if (currPlot->axisRect()->rangeDrag() & Qt::Vertical)
menu->addAction("Disable drag on axis", this, SLOT(toggleVerticalDrag()));
else
menu->addAction("Enable drag on axis", this, SLOT(toggleVerticalDrag()));
} else
{
if (currPlot->graphCount() > 0)
menu->addAction("Scale axes to fit", this, SLOT(rescaleAxes()));
if (currPlot->selectedGraphs().size() > 0)
menu->addAction("Remove selected graph", this, SLOT(removeSelectedGraph()));
if (currPlot->graphCount() > 0)
menu->addAction("Remove all graphs", this, SLOT(removeAllGraphs()));
}
menu->popup(currPlot->mapToGlobal(pos));
}