I found that when the plot is disabled (by setEnabled(false) of plot's parent's parent), the picker and zoomer still works.
What is the elegant way to disable picker&zoomer when the plot is disabled?
I found that when the plot is disabled (by setEnabled(false) of plot's parent's parent), the picker and zoomer still works.
What is the elegant way to disable picker&zoomer when the plot is disabled?
I would subclass QwtPlot and reimplement changeEvent()
...
see code
Qt Code:
#include <QApplication> #include <qwt_plot.h> #include <qwt_plot_zoomer.h> #include <QEvent> { public: { } protected: { { _zoomer->setEnabled(this->isEnabled()); } } private: QwtPlotZoomer* _zoomer; }; int main(int argc, char *argv[]) { plot->setEnabled(false); plot->show(); return a.exec(); }To copy to clipboard, switch view to plain text mode
Thanks your share.
Because the zoomer/picker is not always enabled in my case,
I must remember the picker/zoomer's state (named oldState) before the plot changes to disabled. Then the plot is enabled, the zoomer should be set to the oldState.
Bookmarks