Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] qdialog window frame - events handling
erez373 last edited by erez373
I'm wondering, given a qdialog who handles the mouse events on the frame (mainly upper frame were 'X' '_' and 'ם' are) like resize, miniize, maximize etc?
It is not the qdialog as I installed event filtering and saw that when mouse leaves to the frame I get qevent 11 (Leave) and next qevent for non client area mouse move (173).
No resize or coursorchanged events.
Moreover, overriding mousemoveevent and any mouse moves on the frame is not passed to that method...
So who is responsible to handle events on the frame?
And how can i catch those events without installing event filter in QApplication?
Thank u all
AFIAK, that part is handled by the OS.
What are you trying to achieve ?
erez373 last edited by
I have a qdialog in which a user can open a context menu. While on windows, if the context menu is opened, moving the mouse to top-right corner of the dialog, the cursor does not change to "resize" cursor.
First click closes the context menu and only the second try allows resizing.
On Mac OSx it behaves differently. While context menu is opened, moving the mouse to top right corner of the dialog changes the cursor to "resize" cursor and the dialog can be resized.
I don't understand why it behaves differently and why resizing is allowed while the the context menu is opened. This is of course not the behavior on different OSx app.
David.G last edited by
It differs by OS I believe. Recently I solved the problem by introducing
setWindowFlags( Qt::CustomizeWindowHint | Qt::Dialog | Qt::WindowTitleHint );which removes the close button and the 'what's this?'. Resizing is simple though, you can't directly disable it but you can tell QDialog to:
QSize size(400,500); dialog.setMaximumSize(size); dialog.setMinimumSize(size);
The dialog won't be able to resize beyond that.
That might be a glitch in the handling of the contextual menu. Can you share the code where you create and use it ?
erez373 last edited by
I cannot share my code.
Nevertheless, the issue is solved once I set a parent to the contectmenu which is the qDialog.
And... I set an event filter to QApplication and found out that I had never got the QEvent::CursorChange event when it is changed from pointer to "resize" when hovering the top-right corner. I conclude it is indeed handled by OS.
Good, thanks for sharing your findings !