Results 1 to 3 of 3

Thread: signal doesnt emit

  1. #1

    Default signal doesnt emit

    hi,
    i have problems with a signal.

    so i make the signal in the header file
    Qt Code:
    1. signals:
    2. QString signal_add_to_list(QString, QString);
    To copy to clipboard, switch view to plain text mode 

    and emit it in a funktion
    Qt Code:
    1. emit this->signal_add_to_list(typ, name);
    To copy to clipboard, switch view to plain text mode 

    I connected it with a slot in the same class, just to test if it works.
    Qt Code:
    1. connect(this, SIGNAL(signal_add_to_list(QString,QString)), this, SLOT(slot_test(QString,QString)));
    To copy to clipboard, switch view to plain text mode 

    slot:
    Qt Code:
    1. public slots:
    2. void slot_test(QString atyp, QString aname);
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. void ClassName::slot_test(QString atyp, QString aname){
    2. cout<<"it works"<<atyp.toStdString()<<aname.toStdString()<<endl;
    3. }
    To copy to clipboard, switch view to plain text mode 
    This slot just say "it works" if it would work, but it doesnt. The compiler doesnt say an error or a warning and i already made a few signals in the same class and they works all, but i cant see the reason why this doesnt work.

    Thanks for reading and may you know the answer.

    mark

  2. #2

    Default Re: signal doesnt emit

    sorry my fault. i sent the signal and then i connected the signal with the slot.

    mark

  3. #3
    Join Date
    Dec 2008
    Posts
    32
    Thanks
    17
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: signal doesnt emit

    also signal's return must be "void"

Similar Threads

  1. how to emit signal in a static function ?
    By cxl2253 in forum Qt Programming
    Replies: 32
    Last Post: 7th July 2016, 21:36
  2. pthread instead QThread
    By brevleq in forum Qt Programming
    Replies: 8
    Last Post: 23rd December 2008, 07:16
  3. Connection of custon signals/slots
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2008, 07:04
  4. how to know which button emit the signal?
    By coder1985 in forum Qt Programming
    Replies: 2
    Last Post: 12th January 2008, 14:26
  5. From extends QTreeWidgetItem emit signal?
    By patrik08 in forum Qt Programming
    Replies: 4
    Last Post: 19th May 2006, 14:54

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.