How to prevent QWidget resize if hidden, and process the same resize events after the widget is shown?
-
Hi,
I want to prevent/disable all resize events of a QWidget when hidden (not visible), and process the same resize events after the widget is visible/shown again.
Please help me to this.
Thanks in advance. -
@soma_yarram Override https://doc.qt.io/qt-5/qwidget.html#resizeEvent and ignore the events as long as https://doc.qt.io/qt-5/qwidget.html#isHidden returns true. You can also store the events for later processing.
-
@jsulm : Is there any general approach to do this? I mean: is there any Qt flag to achieve this? For example: Qt::WA_PendingResizeEvent. Problem is that I have only couple of widgets which cause crash because resize event is triggered before show.
-
@soma_yarram I doubt there is something like this in Qt as your requirement is quite special.
If you have crashes you should rather find and fix the reason instead of implementing workarounds.