本文整理汇总了C++中QwtPlotMarker::setAxis方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotMarker::setAxis方法的具体用法?C++ QwtPlotMarker::setAxis怎么用?C++ QwtPlotMarker::setAxis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotMarker
的用法示例。
在下文中一共展示了QwtPlotMarker::setAxis方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: enableZeroLineY
void Grid::enableZeroLineY(bool enable) {
Plot *d_plot = dynamic_cast<Plot *>(plot());
if (!d_plot)
return;
if (mrkY < 0 && enable) {
QwtPlotMarker *m = new QwtPlotMarker();
mrkY = d_plot->insertMarker(m);
m->setRenderHint(QwtPlotItem::RenderAntialiased, false);
m->setAxis(xAxis(), yAxis());
m->setLineStyle(QwtPlotMarker::HLine);
m->setValue(0.0, 0.0);
double width = 1;
if (d_plot->canvas()->lineWidth())
width = d_plot->canvas()->lineWidth();
else if (d_plot->axisEnabled(QwtPlot::xBottom) ||
d_plot->axisEnabled(QwtPlot::xTop))
width = d_plot->axesLinewidth();
m->setLinePen(QPen(Qt::black, width, Qt::SolidLine));
} else if (mrkY >= 0 && !enable) {
d_plot->removeMarker(mrkY);
mrkY = -1;
}
}
示例2: insertLineMarker
/*!
This function is a shortcut to insert a horizontal or vertical
line marker, dependent on the specified axis.
\param label Label
\param axis Axis to be attached
\return New key if the marker could be inserted, 0 if not.
*/
long QwtPlot::insertLineMarker(const QString &label, int axis)
{
QwtMarker::LineStyle lineStyle = QwtMarker::NoLine;
int xAxis = QwtPlot::xBottom;
int yAxis = QwtPlot::yLeft;
switch(axis)
{
case yLeft:
case yRight:
yAxis = axis;
lineStyle = QwtMarker::HLine;
break;
case xTop:
case xBottom:
xAxis = axis;
lineStyle = QwtMarker::VLine;
break;
}
QwtPlotMarker *marker = new QwtPlotMarker(this);
if ( marker == 0 )
return 0;
marker->setAxis(xAxis, yAxis);
marker->setLabel(label);
marker->setLineStyle(lineStyle);
marker->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
long key = insertMarker(marker);
if ( key == 0 )
delete marker;
return key;
}
示例3: enableZeroLineX
void Grid::enableZeroLineX(bool enable)
{
Plot *d_plot = (Plot *)plot();
if (!d_plot)
return;
if (mrkX<0 && enable) {
QwtPlotMarker *m = new QwtPlotMarker();
mrkX = d_plot->insertMarker(m);
m->setRenderHint(QwtPlotItem::RenderAntialiased, false);
m->setAxis(xAxis(), yAxis());
m->setLineStyle(QwtPlotMarker::VLine);
m->setValue(0.0, 0.0);
double width = 1;
if (d_plot->canvas()->lineWidth())
width = d_plot->canvas()->lineWidth();
else if (d_plot->axisEnabled (QwtPlot::yLeft) || d_plot->axisEnabled (QwtPlot::yRight))
width = d_plot->axesLinewidth();
m->setLinePen(QPen(Qt::black, width, Qt::SolidLine));
} else if (mrkX >= 0 && !enable) {
d_plot->removeMarker(mrkX);
mrkX=-1;
}
}
示例4: insertMarker
/*!
\brief Insert a new marker
\param label Label
\param xAxis X axis to be attached
\param yAxis Y axis to be attached
\return New key if the marker could be inserted, 0 if not.
*/
long QwtPlot::insertMarker(const QString &label, int xAxis, int yAxis)
{
QwtPlotMarker *marker = new QwtPlotMarker(this);
if ( marker == 0 )
return 0;
marker->setAxis(xAxis, yAxis);
marker->setLabel(label);
long key = insertMarker(marker);
if ( key == 0 )
delete marker;
return key;
}