Results 1 to 3 of 3

Thread: Auto-connecting slots for object *this*?

  1. #1
    Join Date
    Dec 2006
    Posts
    160
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Auto-connecting slots for object *this*?

    Hello,

    I am trying to understand the behavior of the auto-connexion feature of signals->slots.
    I have successfully connected various signals to slots, for instance using a method declaration named void on_btnDoIt_clicked(void) which perfectly works.

    Now i am very lazy and want to make my code a bit more clear... I deleted the connect for a signal "finished"... And i'm guessing, how to auto connect it? I tried using on_this_finished(), on_self_finished() and on_finished()... None worked. What is the keyword to use to auto-connect a slot in the *current* object to the *current* object?

    Thanks for your help ^^
    Pierre.

    [EDIT:]All my attempts were done using the default parametters of "finished" signal, a single int.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Auto-connecting slots for object *this*?

    It seems that it's impossible to do it with QMetaObject::connectSlotsByName():
    void QMetaObject::connectSlotsByName ( QObject * object ) [static]
    Searches recursively for all child objects of the given object, and connects matching signals from them to slots of object that follow the following form:
    void on_<widget name>_<signal name>(<signal parameters>);
    You will have to write your own function that operates only on the given object, not its children.
    Last edited by jacek; 6th April 2007 at 14:23. Reason: typo

  3. The following user says thank you to jacek for this useful post:

    hickscorp (6th April 2007)

  4. #3
    Join Date
    Dec 2006
    Posts
    160
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Auto-connecting slots for object *this*?

    Thank you, you answered to my question ^^

Similar Threads

  1. Adding slots in Designer
    By jamos in forum Qt Tools
    Replies: 5
    Last Post: 18th May 2006, 23:28
  2. Connecting signals & slots across different threads
    By jyoti kumar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 12:40

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.