Re: error: expected unqualified-id before numeric constant
And are you positive that the error is from that line, where you create the QKeyEvent?
And what about this?
There is still a space in the middle of QString.
Jpn also asked this, and now you have the same error? How is this a copy-paste error?
Regards
Re: error: expected unqualified-id before numeric constant
I still cannot spot the error.
Does it compile if you remove that line?
Apart from the problem you have, this is not correct:
keyPressEvent is not meant to be called like that.
Use qApp->postEvent instead.
Regards
Re: error: expected unqualified-id before numeric constant
Hi Marcel,
Could you get some clue? I have traced that due to QEvent::KeyPress, the error is coming, Compiler is unable to recognize the the keyword.
Re: error: expected unqualified-id before numeric constant
Could you post the include section from that file?
All the includes.
Regards
Re: error: expected unqualified-id before numeric constant
Hi,
I'm using Qt4.1, and I had the same problem and I have resolved it with an include and a replacement :
#include <QKeyEvent> //that's very important
(QEvent::Type)6 instead of QEvent::KeyPress
example :
KeyEvent* kevent = new QKeyEvent((QEvent::Type)6,buffer[0],(Qt::KeyboardModifiers)Qt::NoModifier,buffer,fals e,1);
I hope it will help someone.
Re: error: expected unqualified-id before numeric constant
You sure don't have to use such ugly C-style casts when you have the necessary include directive in place.
Code:
#include <QKeyEvent>
...
Re: error: expected unqualified-id before numeric constant
I don't understand why you don't use enum Qt::Key for second parameter in QKeyEvent ctor? :confused:
Re: error: expected unqualified-id before numeric constant
The problem is likely that you are including X.h which has
Code:
// X.11.h
...
...
#define KeyPress 2
So the preprocessor is converting this to...
Try adding
Code:
#undef KeyPress // safe as long as you are not referencing KeyPress from X.h after this line
i.e. assuming that further down you won't be referring to KeyPress from X.h
Re: error: expected unqualified-id before numeric constant
Why are you replying to a nearly 12 year old thread? Please check the date of the last post in a thread before bringing one back from the dead.