Hi,
I am trying to sublass QLabel to create a label capable of handling mouse click events. The following code works fine:
Code:
#include <QtGui> { Q_OBJECT public: protected: { if (event->button()==Qt::LeftButton) { qWarning() << Q_FUNC_INFO; } } }; #include "main.moc" int main(int argc, char *argv[]) { MyLabel l; l.setText("foo bar"); l.show(); return app.exec(); }
What I don't understand is, when I try to define MyLabel class in a seperate header file, Qt does not compile anymore! Why is this happening?
Thank you
