Results 1 to 2 of 2

Thread: Using new Qt Signal Slot connection for QtService framework classes

  1. #1
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Using new Qt Signal Slot connection for QtService framework classes

    I would like to know how to use new Qt Signals and Slots with classes of QtService Framework
    The new syntax is of the type -
    Qt Code:
    1. QObject::connect(&a, &Counter::valueChanged,&b, &Counter::setValue);
    To copy to clipboard, switch view to plain text mode 
    This provides compile time checks. So far good.

    Now in Qt Service framework, we get an object of service via
    Qt Code:
    1. QObject * QServiceManager::loadInterface ( const QServiceInterfaceDescriptor & descriptor, QServiceContext * context = 0, QAbstractSecuritySession * session = 0 )
    To copy to clipboard, switch view to plain text mode 
    This returns a pointer to QObject. Now we are expected to connect certain signals from the service like "errorUnrecoverableIPCFault".
    Now we have a pointer of QObject, and the actual service object may be of any type. Now how can I used the new syntax something like -

    Qt Code:
    1. connect(pServiceObject,&QObject::errorUnrecoverableIPCFault,this,&MyClass::onErrorUnrecoverableIPCFault);
    To copy to clipboard, switch view to plain text mode 

    I cannot use the above format since QObject doesnt have signal errorUnrecoverableIPCFault
    The signal is emitted from somewhere within Qt Service framework, and is also not part of my Service class implementation.


    So my question is how to use new format of Signal Slots in such cases ??

  2. #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: Using new Qt Signal Slot connection for QtService framework classes

    The compile time checked signal/slot obviously needs type information, i.e. the compiler needs to know the type of the object in order to check for method availability.

    So you either provide that, i.e. make sure that pServiceObject is at least casted to the interface containing errorUnrecoverableIPCFault() and provide that interface's class name when passing the member function pointer.

    Cheers,
    _

Similar Threads

  1. Signal/Slot connection problem
    By nightroad in forum Newbie
    Replies: 2
    Last Post: 6th April 2011, 09:30
  2. Signal and Slot connection not working !!
    By prakash437 in forum Qt Programming
    Replies: 3
    Last Post: 17th May 2010, 10:16
  3. Signal and slot connection graph
    By fahlen in forum General Discussion
    Replies: 4
    Last Post: 27th November 2007, 13:47
  4. Error signal connection between 2 classes
    By mattia in forum Newbie
    Replies: 6
    Last Post: 31st October 2007, 09:36
  5. signal slot connection
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 4th July 2006, 13:31

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.