Results 1 to 5 of 5

Thread: Does it is possible to connect more than one function into a Slot ?

  1. #1
    Join Date
    Jul 2011
    Location
    BRAZIL-RIO DE JANEIRO
    Posts
    47
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Does it is possible to connect more than one function into a Slot ?

    Hi friends,


    I wish know if instead above structure :
    Qt Code:
    1. connect(_ui->buttonRecord , SIGNAL(clicked()) , this , SLOT(function1()));
    To copy to clipboard, switch view to plain text mode 
    Could I do something like that ?
    Qt Code:
    1. connect(_ui->buttonRecord , SIGNAL(clicked()) , this , SLOT(function1() ;function2() ));
    To copy to clipboard, switch view to plain text mode 

    +++

  2. #2
    Join Date
    Aug 2011
    Posts
    33
    Thanks
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Does it is possible to connect more than one function into a Slot ?

    No, you cannot do that.

    What are you trying to do?

    You'll get more help if you're more explicit about what you are trying to do.

    If you want to connect more than one signal to the same slot, well can be done two ways that I know of: with the QSignalMapper and QBuggonGroup.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Does it is possible to connect more than one function into a Slot ?

    Did you try the obvious?
    Qt Code:
    1. connect(_ui->buttonRecord , SIGNAL(clicked()) , this , SLOT(function1()));
    2. connect(_ui->buttonRecord , SIGNAL(clicked()) , this , SLOT(function2()));
    To copy to clipboard, switch view to plain text mode 

    From QObject::connect():
    A signal can be connected to many slots and signals. Many signals can be connected to one slot.

    If a signal is connected to several slots, the slots are activated in the same order as the order the connection was made, when the signal is emitted.

  4. The following user says thank you to ChrisW67 for this useful post:

    andre_teprom (14th August 2011)

  5. #4
    Join Date
    Aug 2011
    Posts
    33
    Thanks
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Does it is possible to connect more than one function into a Slot ?

    Oh, my!

    I didn't know you could do that!

  6. #5
    Join Date
    Jul 2011
    Location
    BRAZIL-RIO DE JANEIRO
    Posts
    47
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Does it is possible to connect more than one function into a Slot ?

    That was exactly what I need.
    I tryed and worked fine.

    Thanks a lot !

Similar Threads

  1. Slot function not being executed in connect
    By Leirbag89 in forum Newbie
    Replies: 7
    Last Post: 19th May 2011, 19:53
  2. Connect slot to an int function !?
    By hakermania in forum Newbie
    Replies: 23
    Last Post: 30th December 2010, 12:08
  3. Can't connect a signal to a slot
    By cejohnsonsr in forum Newbie
    Replies: 5
    Last Post: 26th August 2010, 20:42
  4. connect a qpushbutton a slot
    By Lycus HackerEmo in forum Newbie
    Replies: 13
    Last Post: 29th March 2010, 09:14
  5. Qt Designer & Qt4, connect to my own slot.
    By geitosten in forum Newbie
    Replies: 2
    Last Post: 17th February 2007, 19:22

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.