1

I have a QMainWindow that, sometimes, resizes when I add a dock widget to it. I would like to prevent that size change because it makes the window too big for the screen.

I have thought to undock the widget if it causes the problem, but I don't find any QWidget event that trigger just after the window' size change. Is there any event that I could use in my dock widget to know that the window just resized because of it?

Robin G.
  • 43
  • 4
  • can't you set the max size of the window instead? – Alan Birtles Feb 02 '21 at 08:23
  • I have tried this [solution](https://stackoverflow.com/a/9862147) before, it worked quite well. – Ceopee Feb 02 '21 at 08:26
  • Thanks for your tips but in order to correctly see the other widgets, I would like to undock my docked widget. I thus need to find an event that fires after the window' size change. – Robin G. Feb 02 '21 at 08:40
  • "I don't find any QWidget event that trigger just after the window' size change". Doesn't the [resizeEvent](https://doc.qt.io/qt-5/qwidget.html#resizeEvent) what you need? – Kao Feb 02 '21 at 09:39
  • Do you mean overriding the QMainWindow::resizeEvent to emit a signal and connect to this signal in my dock widget implementation so I can verify the size of the window in it? If so, I may resize the window in my dock widget to ensure it is not too big for the screen, so it may retrigger the resizeEvent. I think it could cause endless loop :/ – Robin G. Feb 02 '21 at 10:23

0 Answers0