Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi..

Myself being a newbie in Qt.I tried to write an application in Qt with some other code included.But that code already contain functions like emit(),event used.So how can i use these in this Qt application without a clash with the Qt keywords.
Posted

Qt class member functions like QObject::event()[^] don't conflict with global functions or member functions of other classes with similar names. This is basic C++ functionality. Use the scope resolution operator[^] when necessary.
 
Share this answer
 
It sounds on the face of it you will need to do some refactoring of your calls to emit() in the other code.

If emit is a method on another base class, then it should just be a case of ensuring it is this scope that is resolved (ie Base::emit()) If the emit() function is a global function in an external library, you may be able to just use ::emit(), or create a namespace wrapped version of emit() by creating a new header and source file with a Namespace::emit() defined to call the emit() function outside of Qt.

Of course, this is a bit of a guess as I don't know the structure of your existing code and how it is being used. Hope it's of help though.
 
Share this answer
 
But with the emit function in the other code which i included , i am receving errors in my qt application.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900