QwtPlot-resizeEvent Discarding Qualifiers
-
Hi, I'm trying to constrain the proportions of a QwtPlot when resizing the window, but I keep running into this error: passing ‘const QSize’ as ‘this’ argument of ‘void QSize::setHeight(int)’ discards qualifiers
This is the code I'm using:
@void QwtPlot::resizeEvent (QResizeEvent * e) {
int h = e->oldSize().height();
int w = e->oldSize().width();int newW = e->size().width()*h/w; e->size().setHeight(newW); QFrame::resizeEvent(e); updateLayout();
}@
I'm not sure if it's strictly and QwtPlot problem or a general problem. I've tried replacing newW with a number (400) but I still got the same problem. What am I doing wrong?
Thanks.
-
You can't set the e->size() property. It's read-only, in effect.
Perhaps you want to use "QWidget::setMaximumSize()":http://doc.qt.nokia.com/latest/qwidget.html#maximumSize-prop or one of its relatives.
-
Ah. I misunderstood what you were wanting, I think. Check out "QWidget::heightForWidth()":http://doc.qt.nokia.com/latest/qwidget.html#heightForWidth and see if reimplementing that handles your situation.