That's not true. That was a direct answer to a snippet you posted, namely:
Code:
#define MAKE_OBJECT \
{ \
Q_OBJECT \
public slots: \
void do_nothing {} \
};
MAKE_OBJECT
This wouldn't work because at the time when MAKE_OBJECT is expanded by cpp it is already too late to generate a meta-object for the class.
Using this instead:
Code:
#ifdef MAKE_OBJECT
{ \
Q_OBJECT \
public slots: \
void do_nothing {} \
};
#endif
and defining MAKE_OBJECT prior to calling qmake (i.e. DEFINES += MAKE_OBJECT) would probably work because there is a good chance that the meta-object would be generated (as Q_OBJECT macro is present in class definition) and then cpp would expand the macro and compile the proper code.
This is probably not what you want as what I understand now (at least I think so), you want to actually want the macro to have variables for signal/slot signatures. This wasn't evident at the time of your writing so you can only blame yourself for providing a code snippet unrelated to what you actually want to do instead of judging my C++ skills. They are yet to fail me.
That's a good example that you should think twice before making such assumptions.
I did not, look at my first post in the thread. I'm still not sure I do.
That's your personal opinion and it's false. I sometimes do withhold information because of my own reasons (mainly educational to push someone in the right direction and let him find the solution himself instead of providing off-the-shelf code for them) but not in this case.
Sorry to be blunt but I think others would also agree that if someone was trolling, it was not me. And you are really balancing on the edge with your posts. We're patient here but our patience has its limits and order needs to be kept so please constrain yourself a bit when it comes to choosing words you use.
Without this crap you would have nothing to investigate. Bear that in mind.
I suggest you stop wasting your time and switch jobs, hobbies or whatever makes you be a software developer. Become an astronaut or a shoe salesman, I don't really care. If you keep being rude the job won't really matter -- you'll still just be a rude person.
Thank you. We're still waiting for your first time to say "thank you" and stop being rude.
To really answer "properly" the problem you described in a so obscured way: you need to handle the whole signal activation routine yourself. Infrastructure for it is usually provided by the meta-object generated by moc but all the code really required is already there (in Qt) without it, there is just no infrastructure to use it. This is something you have to provide yourself and to do that you need to dig deeply in Qt's code since there is a couple of undocumented methods that you need to use. Also read this article, it describes a very simplified mechanism (based on Qt3) for handling custom signals (which is more or less what you want to do):
http://doc.qt.nokia.com/qq/qq16-dynamicqobject.html. And forget the C preprocessor, I don't have the slightest idea how you wanted to use it to solve your problem. I would rather go in the direction of using C++ templates rather than cpp (although that wouldn't work here as well as templates are expanded by the compiler so they can't contain Q_OBJECT macros).