Hey,


I have multiple custom widgets, wrapped in QDockWidgets and docked next to each other. I'd like to know which docking widget the user worked with last, so i implemented the focusEvent:

Qt Code:
  1. virtual void focusInEvent(QFocusEvent*);
To copy to clipboard, switch view to plain text mode 

in the custom QDockWidget.
However, the function is called only once (when the widget is initially shown) and not when i focus a widget (by for example clicking on it).
Why not?

edit:
Undocking focuses the widget! Not sure why and how, though, it is not via focusInEvent().


A related problem is the dispatching of shortcuts for the individual widgets. All of them implement the same, resulting in a "Ambiguous shortcut overload" when several widgets are visible simultaneously.
I was told to implement the eventFiler() function for the QMainWindow, listen for FocusEvents and call the appropriate widget. THis is a little tricky as with shortcut recognition and widget identification, but the eventFilter is also not called at
all:


Qt Code:
  1. bool eventFilter(QObject *object, QEvent *event)
  2. {
  3. if(event->type() == QEvent:FocusIn)
  4. {
  5. ...
  6.  
  7. return false;
  8. }
To copy to clipboard, switch view to plain text mode 


What's wrong with my event filter? Is there genrally a better approach of handling shortcuts? One would assume that in the case of "ambiguous" shortcuts the focused widget would receive them.