Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to detect when user changes anything in MainWindow screen.
Hi wondering if anybody has a good solution for this problem I am trying to solve.
I have a MainWindow with a bunch of child QDockWidgets, QMainMenu, and QToolbar's, just standard stuff so far.
What I want to do is be able to detect specific types of events in the MainWindow. The category is any user action with the mouse that causes the screen contents to change and would make it look different than before. For example, the child QDockWidget's can be made not visible, be restored, repositioned, resized. Also the toolbars can be repositioned and resized.
It wouldn't work to have each child object detect this itself and signal the MainWindow (for example) because I need to distinguish between user actions upon individual widgets and something like restoreState actions, which I have as a main menu item. So i need to know whether the screen change was due to the user changing a specific child widget or the user choosing the menu item (or toolbar button to do this) restoreState option.
If anybody has any good suggestions I would really appreciate some tips.
mrdebug last edited by
In Windows per esempio, è possibile utilizzare il modo VNC. Devi costruire una dll e allegarlo a ciascuno dei processi di sessione. Con esso è possibile avere gli eventi come evento del mouse e altro ancora.
I'm not sure what that is saying as it is not in quite in English.
Anybody??? Going once....Maybe I need to simplify my question...if so feel free to comment on that as well.
mrdebug last edited by
Sorry for the mistake.
In Windows, for example, you can use a VNC mode. You have to build a dll and attach it to each of the processes of the session. With it you can have events such as mouse events, and more.
there is no all-in-one wonder solution for this ;)
QDockWidget and QToolBar provides signals for several types of changes.
You will need to connect to them when you create the instances.
If you don't want the signals to be triggered in some situations when you change something programatically you have to do this:
w-> ... // change something which might trigger signals
Well here is what I have tried so far;
calling disconnect() on all the QDockWidget's and QToolsBar's so they wouldn't signal the MainWindow when I use the restoreState menu option.
The only problem with that potential solution is that I have to reconnect them....at some point. How to know when to reconnect all these child objects.
Any thoughts on my general idea and how to address this hole in my solution??
do as i said ... use blockSignals() when you don't want to trigger the signals...