QWidget not resizing on QtDesigner
-
Dear all,
I have two identical projects, one uses QtDesigner to load some widgets and the other loads them directly from code. In both of them i wanted a widget to be resized when the user resizes the window. In the project that does not use QtDesigner that happens perfectly well but in the other identical QtDesigner project it does not resize at all.
I have used the following code in my widget class to make the resize happen:
void LineWidget::resizeEvent(QResizeEvent *) { m_defaultChartView->resize(size()); }
So for some reason the two projects, even if they are identical they do not behave in the same way.
Any idea what might be going on?
you can see the complete code of the project in my last post.
Thank you for any hints.
Best,
w -
@wasawi2 said in QWidget not resizing on QtDesigner:
i wanted a widget to be resized when the user resizes the window
Why don't you simply use layouts?
https://doc.qt.io/qt-6/layout.html -
@wasawi2
Start by placing some breakpoints/debug messages e.g. in yourresizeEvent()
? Check the value ofsize()
.Not sure why you have to do this resize in code, but maybe. Your
LineWidget
instance(s) themselves have a layout onto which the chart view is placed?