本文整理汇总了C++中QwtLegend::setVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtLegend::setVisible方法的具体用法?C++ QwtLegend::setVisible怎么用?C++ QwtLegend::setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtLegend
的用法示例。
在下文中一共展示了QwtLegend::setVisible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Plots_Create
//---------------------------------------------------------------------------
void Plots::Plots_Create(PlotType Type)
{
// Paddings
if (paddings[Type]==NULL)
{
paddings[Type]=new QWidget(this);
paddings[Type]->setVisible(false);
}
// General design of plot
QwtPlot* plot = new QwtPlot(this);
plot->setVisible(false);
plot->setMinimumHeight(1);
plot->enableAxis(QwtPlot::xBottom, Type==PlotType_Axis);
plot->setAxisMaxMajor(QwtPlot::yLeft, 0);
plot->setAxisMaxMinor(QwtPlot::yLeft, 0);
plot->setAxisScale(QwtPlot::xBottom, 0, FileInfoData->Videos[0]->x_Max[XAxis_Kind_index]);
if (PerPlotGroup[Type].Count>3)
plot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// Plot grid
QwtPlotGrid *grid = new QwtPlotGrid();
grid->enableXMin(true);
grid->enableYMin(true);
grid->setMajorPen(Qt::darkGray, 0, Qt::DotLine );
grid->setMinorPen(Qt::gray, 0 , Qt::DotLine );
grid->attach(plot);
// Plot curves
for(unsigned j=0; j<PerPlotGroup[Type].Count; ++j)
{
plotsCurves[Type][j] = new QwtPlotCurve(PerPlotName[PerPlotGroup[Type].Start+j].Name);
QColor c;
switch (PerPlotGroup[Type].Count)
{
case 1 :
switch (Type)
{
case PlotType_YDiff: c=Qt::darkGreen; break;
case PlotType_UDiff: c=Qt::darkBlue; break;
case PlotType_VDiff: c=Qt::darkRed; break;
default: c=Qt::black;
}
break;
case 2 :
switch (j)
{
case 0: c=Qt::darkGreen; break;
case 1: c=Qt::darkRed; break;
default: c=Qt::black;
}
break;
case 3 :
switch (j)
{
case 0: c=Qt::darkRed; break;
case 1: c=Qt::darkBlue; break;
case 2: c=Qt::darkGreen; break;
default: c=Qt::black;
}
break;
case 5 :
switch (j)
{
case 0: c=Qt::red; break;
case 1: c=QColor::fromRgb(0x00, 0x66, 0x00); break; //Qt::green
case 2: c=Qt::black; break;
case 3: c=Qt::green; break;
case 4: c=Qt::red; break;
default: c=Qt::black;
}
break;
default: c=Qt::black;
}
plotsCurves[Type][j]->setPen(c);
plotsCurves[Type][j]->setRenderHint(QwtPlotItem::RenderAntialiased);
plotsCurves[Type][j]->setZ(plotsCurves[Type][j]->z()-j); //Invert data order (e.g. MAX before MIN)
plotsCurves[Type][j]->attach(plot);
}
// Legends
QwtLegend *legend = new QwtLegend(this);
legend->setVisible(false);
legend->setMinimumHeight(1);
legend->setMaxColumns(1);
QFont Font=legend->font();
#ifdef _WIN32
Font.setPointSize(6);
#else // _WIN32
Font.setPointSize(8);
#endif //_WIN32
legend->setFont(Font);
connect(plot, SIGNAL(legendDataChanged(const QVariant &, const QList<QwtLegendData> &)), legend, SLOT(updateLegend(const QVariant &, const QList<QwtLegendData> &)));
plot->updateLegend();
// Assignment
plots[Type]=plot;
//.........这里部分代码省略.........