本文整理汇总了C++中QwtPlot::axisEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlot::axisEnabled方法的具体用法?C++ QwtPlot::axisEnabled怎么用?C++ QwtPlot::axisEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlot
的用法示例。
在下文中一共展示了QwtPlot::axisEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hasColorScale
bool Spectrogram::hasColorScale() {
QwtPlot *plot = this->plot();
if (!plot)
return false;
if (!plot->axisEnabled(color_axis))
return false;
QwtScaleWidget *colorAxis = plot->axisWidget(color_axis);
return colorAxis->isColorBarEnabled();
}
示例2: showColorScale
void Spectrogram::showColorScale(int axis, bool on)
{
if (hasColorScale() == on && color_axis == axis)
return;
QwtPlot *plot = this->plot();
if (!plot)
return;
QwtScaleWidget *colorAxis = plot->axisWidget(color_axis);
colorAxis->setColorBarEnabled(false);
color_axis = axis;
// We must switch main and the color scale axes and their respective scales
int xAxis = this->xAxis();
int yAxis = this->yAxis();
int oldMainAxis = yAxis;
if (axis == QwtPlot::xBottom || axis == QwtPlot::xTop)
{
oldMainAxis = xAxis;
xAxis = 5 - color_axis;
}
else if (axis == QwtPlot::yLeft || axis == QwtPlot::yRight)
{
oldMainAxis = yAxis;
yAxis = 1 - color_axis;
}
// First we switch axes
setAxis(xAxis, yAxis);
// Next we switch axes scales
QwtScaleDiv *scDiv = plot->axisScaleDiv(oldMainAxis);
if (axis == QwtPlot::xBottom || axis == QwtPlot::xTop)
plot->setAxisScale(xAxis, scDiv->lBound(), scDiv->hBound());
else if (axis == QwtPlot::yLeft || color_axis == QwtPlot::yRight)
plot->setAxisScale(yAxis, scDiv->lBound(), scDiv->hBound());
colorAxis = plot->axisWidget(color_axis);
plot->setAxisScale(color_axis, data().range().minValue(), data().range().maxValue());
colorAxis->setColorBarEnabled(on);
colorAxis->setColorMap(data().range(), colorMap());
if (!plot->axisEnabled(color_axis))
plot->enableAxis(color_axis);
colorAxis->show();
plot->updateLayout();
}