
Originally Posted by
nroberts
The correct answer to my problem is apparently that what I want to do is impossible to do.
Hmm....

Originally Posted by
wysota
I doubt this will work with moc.
I rest my case.
As for the rest of the thread: nroberts, please stop trolling around. There are myriads of solutions to your problem. The real problem is that you insist on doing it as part of the main compilation step with the C preproc. I personally implemented something you want, it takes a class description such as:
implicitly shared nullable metatyped class MyClass {
string x;
int y;
sequence<QPoint> points;
};
implicitly shared nullable metatyped class MyClass {
string x;
int y;
sequence<QPoint> points;
};
To copy to clipboard, switch view to plain text mode
and generates on the fly a C++ class with getters, setters and a bunch of other stuff that is later compiled with the rest of the program. This particular example is not meant to be used with moc but the generator can also generate a QAbstractItemModel subclass for the payload class that contains the Q_OBJECT macro and gets processed by moc later on. All is done automatically by properly scripting qmake. The trick is that it is an additional step of the compilation which is something you seem to want to avoid.
Please carefully read our answers instead of treating them as hostile. Note, we might have ignored your posts at all but instead we have chosen to try to help you and answer them. So please try to appreciate it, otherwise in the end you'll be the one who does not get satisfied with the outcome. You will go, we will stay, others will come in your place.
Bookmarks