class NewApplication : public QApplication
{
Q_OBJECT
public:
NewApplication(int& argc, char ** argv);
virtual bool x11EventFilter(XEvent *event);
private:
};
bool NewApplication::x11EventFilter(XEvent *event)
{
switch (event->type) {
case ButtonPress:
{
if (event->xbutton.button == 2) {
// 攔截中鍵 ... 寫你要的動作
}
}
case ButtonRelease:
case KeyPress:
case KeyRelease:
case MotionNotify:
};
return NewApplication::x11EventFilter(event);
}
2. 在mail裡面把建立QApplication改成建立NewApplication
QApplication app(argc, argv);
改成
NewApplication app(argc, argv);
3. start app
app.exec();
沒有留言:
張貼留言