HOWTO: Connect Boost Signals & Slots to Qt Signals & Slots
Hello everyone, Please find the first in a series of articles here: http://www.oxforddynamics.com/articles/connect_qt_and_boost_signals_and_slot... I hope it will be of use! Moderators: is this type of post is acceptable or not? Please let me know if it isn't and I won't post Boost related HOWTOs here again. Kind Regards, John
On 4/22/2013 4:27 AM, John Adamson wrote:
Hello everyone,
Please find the first in a series of articles here:
http://www.oxforddynamics.com/articles/connect_qt_and_boost_signals_and_slot...
I hope it will be of use!
Moderators: is this type of post is acceptable or not? Please let me know if it isn't and I won't post Boost related HOWTOs here again.
I haven't compiled the examples, but in my Qt4.8.4 implementation at 52 of qobjectdefs.h I see: #define Q_EMIT So what effect does it have in the below code? lib_ptr_->signal_1.connect( boost::bind( &Ui::Q_EMIT slot1 , this ) ); Thanks, Jeff
Hi Jeff,
I wouldn't recommend that! Q_EMIT is the alternative macro for the 'emit'
keyword. You need to define QT_NO_KEYWORDS to work with Boost.Signals, but
that prevents the use of the 'emit' keyword.
Please read the short section:
http://www.oxforddynamics.com/articles/connect_qt_and_boost_signals_and_slot...
John
On 23 April 2013 17:48, Jeff Flinn
On 4/22/2013 4:27 AM, John Adamson wrote:
Hello everyone,
Please find the first in a series of articles here:
http://www.oxforddynamics.com/**articles/connect_qt_and_boost_* *signals_and_slots.htmlhttp://www.oxforddynamics.com/articles/connect_qt_and_boost_signals_and_slot...
I hope it will be of use!
Moderators: is this type of post is acceptable or not? Please let me know if it isn't and I won't post Boost related HOWTOs here again.
I haven't compiled the examples, but in my Qt4.8.4 implementation at 52 of qobjectdefs.h I see:
#define Q_EMIT
So what effect does it have in the below code?
lib_ptr_->signal_1.connect( boost::bind( &Ui::Q_EMIT slot1 , this ) );
Thanks, Jeff
______________________________**_________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/**mailman/listinfo.cgi/boost-**usershttp://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi John, Please don't top post. I'm rearranging to make this more readable. On 4/23/2013 11:55 AM, John Adamson wrote:
Hi Jeff,
On 23 April 2013 17:48, Jeff Flinn
mailto:Jeffrey.Flinn@gmail.com> wrote: On 4/22/2013 4:27 AM, John Adamson wrote:
Hello everyone,
Please find the first in a series of articles here:
http://www.oxforddynamics.com/__articles/connect_qt_and_boost___signals_and_... http://www.oxforddynamics.com/articles/connect_qt_and_boost_signals_and_slot...
I hope it will be of use!
Moderators: is this type of post is acceptable or not? Please let me know if it isn't and I won't post Boost related HOWTOs here again.
I haven't compiled the examples, but in my Qt4.8.4 implementation at 52 of qobjectdefs.h I see:
#define Q_EMIT
So what effect does it have in the below code?
lib_ptr_->signal_1.connect( boost::bind( &Ui::Q_EMIT slot1 , this ) );
I wouldn't recommend that! Q_EMIT is the alternative macro for the
Recommend what? I'm just asking a question about what effect Q_EMIT has on getting the above line of code to compile given that in Qt4.8.4 (if not all versions) Q_EMIT /emit is defined to nothing? My understanding is that these keywords are just used to 'document' for the human reader that a signal/slot is being called.
'emit' keyword. You need to define QT_NO_KEYWORDS to work with Boost.Signals, but that prevents the use of the 'emit' keyword.
We never use those poorly chosen lower case macro names and always define QT_NO_KEYWORDS as a matter of best practices. Jeff
On 23 April 2013 18:49, Jeff Flinn
Hi John,
Please don't top post. I'm rearranging to make this more readable.
On 4/23/2013 11:55 AM, John Adamson wrote:
Hi Jeff,
On 23 April 2013 17:48, Jeff Flinn
>> wrote: On 4/22/2013 4:27 AM, John Adamson wrote:
Hello everyone,
Please find the first in a series of articles here:
http://www.oxforddynamics.com/**__articles/connect_qt_and_** boost___signals_and_slots.htmlhttp://www.oxforddynamics.com/__articles/connect_qt_and_boost___signals_and_...
<http://www.oxforddynamics.**com/articles/connect_qt_and_** boost_signals_and_slots.htmlhttp://www.oxforddynamics.com/articles/connect_qt_and_boost_signals_and_slot...
I hope it will be of use!
Moderators: is this type of post is acceptable or not? Please let me know if it isn't and I won't post Boost related HOWTOs here again.
I haven't compiled the examples, but in my Qt4.8.4 implementation at 52 of qobjectdefs.h I see:
#define Q_EMIT
So what effect does it have in the below code?
lib_ptr_->signal_1.connect( boost::bind( &Ui::Q_EMIT slot1 , this ) );
I wouldn't recommend that! Q_EMIT is the alternative macro for the
Recommend what? I'm just asking a question about what effect Q_EMIT has on getting the above line of code to compile given that in Qt4.8.4 (if not all versions) Q_EMIT /emit is defined to nothing? My understanding is that these keywords are just used to 'document' for the human reader that a signal/slot is being called.
'emit' keyword. You need to define QT_NO_KEYWORDS to work with
Boost.Signals, but that prevents the use of the 'emit' keyword.
We never use those poorly chosen lower case macro names and always define QT_NO_KEYWORDS as a matter of best practices.
Jeff
Hello again Jeff, I have not replied here before and did not anticipate my reply would be 'top-posted'. Thank you for correcting it. You phrased your question badly (it wasn't clear why you made it look like you were redefining Q_EMIT) but I see what you meant now. I don't want this to descend into a post about Qt only so I'll simply say: yes, you don't need the Q_EMIT keyword. To avoid confusion I have also updated the article. John
participants (2)
-
Jeff Flinn
-
John Adamson