[SOLVED] Can't catch event



  • Hi All!
    I have @class MainWindow: public QMainWindow@ MainWindow has QSystemTrayIcon as member, in constructor MainWindow's i do @m_trayIcon.installEventFilter(this);@ and try catch the event at @protected: bool eventFilter(QObject *obj, QEvent *ev);@ in MainWindow, but nothing happens. I do this because need analyses some variables and set enable\disable some actions in ContextMenu, who's call at second mouse button click at tray icon. What i do wrong, and maybe some one know ease way to solve this problem?



  • Can you show body of your eventFilter method?



  • something like that:
    @bool eventFilter(QObject *obj, QEvent *ev){
    int someOperationForBreakpoint = 0; //hear i try to see breakpoint int debugger
    return __super::eventFilter(obj, ev);
    }@

    full code stay at work, and i can't show them from home.



  • QSystemTrayIcon is not a widget and therefore does not receive UI related events such as click events, show events, etc (That all handled by the OS, not Qt). You should use the "activated() signal":http://doc.qt.nokia.com/4.7-snapshot/qsystemtrayicon.html#activated instead.



  • Tnx, a lot!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.