On 09/07/2011 07:31 PM, Stephan Beal wrote:
Thanks for the tip, Stephan. I'll paste the tip here to save it for posterity. <quote> Hi,
you're right, there is a collision with 'emit'. However this is a huge mistake from Qt, forbidding anyone to use the 'emit' identifier is simply broken (it even collides with Boost signal). We won't rename 'emit' because it's the right name, and changing it would break backward compatibility. We can work around the problem in our headers by disabling the Qt macro locally, however you would'nt be able to call the method yourself. If you can, define QT_NO_KEYWORDS. This will prevent Qt from defining its broken macros (emit, slots, ...). You can then use Q_EMIT instead to emit signals, see the Qt documentation. This is how I usually proceed. Otherwise, undefine Qt's emit before including our headers, and redefine it (to nothing) after. Do so everytime you have to call an emit function. Cheers, </quote>
It can also be noted that it is also possible to employ sigc++'s functor to emit signals. If I'm not mistaken there is also another way where Qt screws with libsigc++, which is solved by including libsigc++ headers prior to any Qt header. Yet, I don't remember what problem this prevents. Thanks for the help, Rui Maciel |