Results 1 to 3 of 3

Thread: Problem with signals and slots

  1. #1
    Join Date
    Mar 2006
    Posts
    17
    Thanks
    4

    Default Problem with signals and slots

    Hello,
    I have got signal: filtering(Element send,QCString& msg) and slot: filtering(Element& send,QCString& msg) (notice there is & after Element), and I want to modify send variable. But when I connect this signal to slot, this slot is never run. When I remove "&" slot runs. How to solve this problem?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Problem with signals and slots

    Quote Originally Posted by conexion2000
    I have got signal: filtering(Element send,QCString& msg) and slot: filtering(Element& send,QCString& msg) (notice there is & after Element), and I want to modify send variable. But when I connect this signal to slot, this slot is never run. When I remove "&" slot runs. How to solve this problem?
    The parameter types must match exactly. If you want a reference, the signal should also emit a reference.

    signal: void filtering(Element& send, QString& msg)
    slot: void filtering(Element& send, QString& msg)

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem with signals and slots

    Turn the first parameter of the signal into a reference. The signatures of both the signal and the slot have to match.

Similar Threads

  1. Signals and Slots Problem
    By GenericProdigy in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2009, 10:06
  2. Problem with signals & slots
    By Palmik in forum Qt Programming
    Replies: 4
    Last Post: 17th January 2009, 23:45
  3. Problem with SpinBox signals and slots
    By ramstormrage in forum Newbie
    Replies: 4
    Last Post: 2nd May 2008, 02:45
  4. Memory Problem with SIGNALS and SLOTS
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 19th March 2007, 21:39
  5. Problem with Signals and Slots
    By Kapil in forum Newbie
    Replies: 11
    Last Post: 15th February 2006, 12:35

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.