Well, if MOC doesn't want to handle preprocessor code, then you can do it manually.
Are you aware that a preprocessor and MOC are written manually?
You can write your own preprocessor or script to handle the files before they are compiled.
Please don't be so hostile. I just want to help you.
And yes, if you want something as specific as you want, and it doesn't exist, the only thing you can do is create it yourself.
Basically, that's what you already got above.
Your question does not belong in the newbie or even advanced section. You question belongs in a "super geeky nerd" section.
Look at it from the other side.
What I think you have done is made some poor choices along the line.
Can you explain exactly what you want to do in clear and plain text. Don't use the following words: preprocessor, templates, moc
And be verbose.
This is obviously false.
I think you might have just beat the other poster in this thread for most ridiculous response ever, though it is pretty hard to compete with using ifdef to autogenerate classes. Not only is it completely redundant to say, "If it doesn't exist then make it," it is also quite possibly the very wrong thing to do, especially if the cost to make it is higher than worth. Several other options come to mind: live without it, don't use Qt, etc... All of which are quite redundant and beside the point of the real question though and amount to no more than simple efforts to be obnoxious.And yes, if you want something as specific as you want, and it doesn't exist, the only thing you can do is create it yourself.
BULL. The question is simple: how do you use the preprocessor or templates to generate Qt objects.Your question does not belong in the newbie or even advanced section. You question belongs in a "super geeky nerd" section.
The answer is also quite simple and still I'm the only one in this entire thread that even mentioned it: you can't. The rest of your guys' nonsense is just that.
Which is simply an amazing presentation of mind-reading abilities.What I think you have done is made some poor choices along the line.
The question is, and has always been, quite clear in my first post and I answered it myself (in spite of attempts to send me down blind alleys) quite a long time ago; even to the point of including exactly the problem I'm trying to solve.Can you explain exactly what you want to do in clear and plain text. Don't use the following words: preprocessor, templates, moc
And be verbose.
What I mean with helping you is to get to the point to have something that you want.
You're fixed on the preprocessor. Maybe there's another way to do what you want.
But to know this, I need to know exactly what you want, and that's still not clear for me.
By the way, there's a Qt mailing list where you can ask the Qt developers directly for support.
http://lists.qt.nokia.com/mailman/listinfo/qt-interest
I can't decipher what it is you're trying to accomplish, but the C/C++ preprocessor is almost trivially simple; you can learn all there is to know about it in a couple of hours. If you can't figure out how to accomplish something using it, you either have to A) devote a small amount of time to learning how it works, or B) recognize that the preprocessor is almost certainly the wrong tool, and look for another solution.
For starters, perhaps you should also devote some time to A) being polite, and B) providing a reasonably detailed explanation of what the problem is you're trying to solve. Without more information, it's really impossible to suggest any reasonable solution other than to mention that there are many potential tools available for generating code - lex, yacc, perl, python and dozens of others, not to mention C++ and maybe - just maybe - the preprocessor.
The preprocessor is absolutely the right tool for the job and is fully capable of doing exactly what I want. The problem stems from having to use the MOC and its inability to play well with the preprocessor and with templates.
I think the real problem here is that "Newbie" on this forum isn't a place for new Qt users to get help from expert users, but where those answering are also newbies. Even the moderator seems particularly so. Nothing wrong with being a newbie but it is particularly frustrating to ask for help expecting knowledgeable people and running into a bunch of yahoo's claiming to be experts but spout nonsense. In other words, I come here as a complete newb to Qt and have found that the "experts" know less than I do at apparently every level. My bad for coming to the wrong place I suppose, but in my defense it is one of the support links on the Qt site proper.
That said, I'm pretty tired of people "answering" my question just to claim I'm being a) impolite or b) not specific enough. The question is quite clear and has actually been answered already. Anyone else doing so is just going to end up on my ignore list, and if you're here to actually get help....I am an expert; I just happen to be new to Qt. I also don't waste your time with my own ignorance. If you actually have something pertinent to my question that hasn't been brought up then I'm all for hearing it, but I'm tired of people just posting to flame.
When I learned to be an engineer, I was taught that impossible problems do not exist. One tool to solve an impossible problem is to rethink what you want to do. There are always multiple paths to achieve what you want.
So, if you explain in plain english, without refering to a specific technique, what you want to do, someone might give you an better solution. Even if you are a pro, please keep your feet on the ground and accept that even the village idiot might give you inspiration.
After saying you doubt that would work with moc you then suggested
Qt Code:
#ifdef MAKE_OBJECT ... #endifTo copy to clipboard, switch view to plain text mode
This is a purposefully unhelpful response from anyone who knows anything about C++. My actual assumption was that you were an idiot that didn't know anything about C++ or Qt rather than the apparently actual case...you knew exactly what I was trying to do and even had information that might help me that you withheld.
Only now, after weeks of bullshit, you post something mildly interesting in an apparent quest to prove your knowledge rather than being helpful, which you could have done a LONG time ago if you had really wanted. I'd ask for expansion on the idea you finally decided to mention but to tell the truth I'm so sick of your crap that I would rather just investigate the possibility myself. On the other hand, at this point I do have to take into account the very distinct possibility that you've just found a different way to send me off on a wild goose chase to waste even more of my time.
Of course, I'm not trying to avoid anything but a bunch of extra, pointless coding of small utility classes that should be easy to generate automatically. This is the first time you've even said anything that wasn't completely absurd AND redundant.
Added after 4 minutes:
Copied from my original post:
Namely I want to make a QObject that has a slot with some arbitrary signature that translates a Qt signal into a boost signal (which I can use bind with).
Last edited by nroberts; 27th December 2010 at 22:07.
Bookmarks