View Full Version : problem with winevent Function

12th November 2011, 03:04
Hi i am new for QT and i need to use winEvent function but an error appear when i try build my project:
my code is :

bool MainWindow::winEvent(MSG *message, long *result)
//handling message...........

return 0;

this is the error prevent building:

C:\Users\ETC\Documents\QTProjects\Calculator-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug\..\Calculator\mainwindow .cpp:16: error: no 'bool MainWindow::winEvent(MSG*, long int*)' member function declared in class 'MainWindow'

12th November 2011, 04:04
It looks like you are missing the declaration matching this implementation in the protected section of your main window header file.

12th November 2011, 23:02
thanks for replay

I don't think that because i find the declaration in QWidget.h by click "Switch between method declaration/definition" in the context menu.
here is the declaration :

#if defined(Q_WS_WIN)
virtual bool winEvent(MSG *message, long *result);

I built this project successfully few days ago !!!!!!!!! I don't know what happened and what is the solution !!!!!!
please some advice may be helpful
thanks for advanced

Added after 6 minutes:

please any help !!!!!!!!!!!!
i am really need the solution

13th November 2011, 00:21
ChrisW67 already answered, its basic C++ - if you want to reimplement a method in a subclass, you need to declare it again.