PDA

View Full Version : tray icon and all mouse events



tdt
23rd October 2009, 11:57
Hello,
I would like to manipulate with every mousevent on tray icon (No another widget active/show)

possible ways:
1) thru installEventFitler - isnt working
2) derive my own classes (MySystemTrayIcon, and so on) - successfully running, but in my opinion isnt best way (=overload membere function QSystemTrayIconSys::winEvent)
3) thru QAbstractEventDispatcher (not tested)




I have trouble with this code (simplified) (1 way) - never reached
bool Main::eventFilter(QObject *obj, QEvent *ev)

class Main:public QObject
{
...
public:
QSystemTrayIcon* tray;
bool eventFilter(QObject *obj, QEvent *ev);
...
}


Main::Main(QObject* parent):QObject(parent)
{
tray=new NSystemTrayIcon();
....
tray->installEventFilter(this);
}

bool Main::eventFilter(QObject *obj, QEvent *ev)
{
qDebug()<<"event reached";
};


thanks for help and any ideas

Jindrich