I would subclass QwtPlot and reimplement changeEvent()
...
see code
#include <QApplication>
#include <qwt_plot.h>
#include <qwt_plot_zoomer.h>
#include <QEvent>
{
public:
{
}
protected:
void changeEvent
(QEvent * event
) {
if(event
->type
()==QEvent::EnabledChange) {
_zoomer->setEnabled(this->isEnabled());
}
}
private:
};
int main(int argc, char *argv[])
{
plot->setEnabled(false);
plot->show();
return a.exec();
}
#include <QApplication>
#include <qwt_plot.h>
#include <qwt_plot_zoomer.h>
#include <QEvent>
class Plot: public QwtPlot
{
public:
Plot(QWidget* parent=0):QwtPlot(parent)
{
_zoomer = new QwtPlotZoomer(this->canvas());
}
protected:
void changeEvent(QEvent * event)
{
if(event->type()==QEvent::EnabledChange)
{
_zoomer->setEnabled(this->isEnabled());
}
}
private:
QwtPlotZoomer* _zoomer;
};
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QwtPlot* plot = new Plot;
plot->setEnabled(false);
plot->show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks