I want to disable contents autoscaling of QwtPlot, but i don't know how do this.
I wrote a simple hack for this:
...
{
if (o == canvas())
{
if (e
->type
() == QEvent::Resize) {
setAxisScale
(QwtPlot::xBottom,
0, re
->size
().
width());
setAxisScale
(QwtPlot::yLeft,
0, re
->size
().
height());
replot();
}
}
}
class Plot : public QwtPlot
...
bool Plot::eventFilter(QObject* o, QEvent* e)
{
if (o == canvas())
{
if (e->type() == QEvent::Resize)
{
QResizeEvent* re = static_cast<QResizeEvent*> (e);
setAxisScale(QwtPlot::xBottom, 0, re->size().width());
setAxisScale(QwtPlot::yLeft, 0, re->size().height());
replot();
}
}
return QwtPlot::eventFilter(o, e);
}
To copy to clipboard, switch view to plain text mode
But it looks ugly (
This screenshots points to what i mean:
my_needs.jpg
What can i do?
Bookmarks