PDA

View Full Version : QwtPlot rendering when disabled



ChrisW67
11th April 2013, 01:20
Qwt 6.0.3, Qt 4.8.4, Linux.

I was expecting this code to generate a disabled widget (it does) with the plot title, legend, and maybe plot curves, ghosted (it does not). The scales and their labels get ghosted. Am I missing something or is this a "feature"?


#include <QtGui>
#include "qwt_plot.h"
#include <qwt_plot_curve.h>
#include <qwt_legend.h>

static const double x[] = { 0.0, 1.0, 2.0, 3.0 };
static const double y[] = { 0.0, 1.0, 4.0, 9.0 };

int main(int argc, char **argv)
{
QApplication app(argc, argv);

QwtPlot myPlot;
myPlot.setTitle("Test");
myPlot.setAxisTitle( QwtPlot::xBottom, "X" );
myPlot.setAxisTitle( QwtPlot::yLeft, "Y" );
QwtLegend *legend = new QwtLegend;
myPlot.insertLegend( legend, QwtPlot::BottomLegend );

QwtPlotCurve *curve = new QwtPlotCurve("Curve");
curve->setLegendAttribute( QwtPlotCurve::LegendShowLine );
curve->setPen(QColor(Qt::red));
curve->setSamples(x, y, 4);
curve->attach(&myPlot);

myPlot.setEnabled(false);
myPlot.show();

return app.exec();
}

8921