Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to emit resize event intentionally?
darkgaze last edited by
I´m in a class that creates all custom widgets. But the main window doesn´t emit the resize at the beginning of the app. I would like to generate the event by hand, or make it happen somehow so it positions the widgets correctly at the beginning.
How do i do it?. I don´t know the size of the window or anything else, so the Event i emit i don´t know what should be there.
podsvirov last edited by
If you are referring to the QMainWindow, it is inherited from the QWidget.
You can override the void QWidget::resizeEvent(QResizeEvent *event) and send a signal out of it:
void MyMainWindow::resizeEvent (QResizeEvent *event)
// My signal
brucechidester last edited by
Resizing it will sent the event.
butterface last edited by
It does not because it is not resized. What do you want to achieve exactly?
ZeAL0T last edited by
Do not cheat yourself. You should use layouts. If you use a QMainWindow the best practice will be to use a QMdiArea for handling internal windows. If you use a simple QWidget, just apply one of the layouts (for example QVBoxLayout) and you will be sure that everything will be look perfect.
Using signals of resizes for widgets positioning looks very strange.
If the layouts don't work for it, probably you did something wrong.