Results 1 to 7 of 7

Thread: How to use slots in the namespace class

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,321
    Thanks
    316
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to use slots in the namespace class

    However, Qt5's function pointer based connect() can connect to functions that are not slots.
    In addition, there are versions of this connect() that do not require a QObject receiver pointer. From the docs for QObject::connect():

    Qt Code:
    1. void someFunction();
    2. QPushButton *button = new QPushButton;
    3. QObject::connect(button, &QPushButton::clicked, someFunction);
    To copy to clipboard, switch view to plain text mode 

    So potentially if the code in the original post was cleaned up to proper C++ syntax, then the "someFunction" above could be prefaced by the namespace.

  2. The following user says thank you to d_stranz for this useful post:

    anda_skoa (7th December 2015)

  3. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to use slots in the namespace class

    Quote Originally Posted by d_stranz View Post
    In addition, there are versions of this connect() that do not require a QObject receiver pointer.
    Yes, indeed!

    I thought that would be kind of implicit by me writing "function" instead of "method" but it made sense to point this out explicitly

    Cheers,
    _

Similar Threads

  1. “Pass” slots from class to class
    By bmn in forum Qt Programming
    Replies: 1
    Last Post: 3rd October 2015, 00:17
  2. Replies: 2
    Last Post: 26th July 2015, 15:38
  3. How to avoid "class namespace" repetition?
    By arcull in forum General Programming
    Replies: 13
    Last Post: 3rd July 2015, 07:07
  4. Replies: 0
    Last Post: 3rd July 2014, 16:48
  5. Access a class without using Signals/Slots
    By impeteperry in forum Qt Programming
    Replies: 5
    Last Post: 10th January 2010, 11:14

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.