Well... it works just fine for me...
#include <QtGui>
public:
protected:
if(e
->type
() == QEvent::MouseButtonPress) { qDebug() << "CLICK";
}
return false;
}
};
int main(int argc, char **argv) {
view.setScene(&scene);
Monitor monitor;
view.viewport()->installEventFilter(&monitor);
view.show();
return app.exec();
}
#include <QtGui>
class Monitor : public QObject {
public:
Monitor(QObject *parent = 0) : QObject(parent) {}
protected:
bool eventFilter(QObject *o, QEvent *e) {
if(e->type() == QEvent::MouseButtonPress) {
qDebug() << "CLICK";
}
return false;
}
};
int main(int argc, char **argv) {
QApplication app(argc, argv);
QGraphicsView view;
QGraphicsScene scene(0,0,2000,2000);
view.setScene(&scene);
Monitor monitor;
view.viewport()->installEventFilter(&monitor);
view.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks