Results 1 to 2 of 2

Thread: signal and slot passing data between a dialog and object, signal error

  1. #1
    Join Date
    Dec 2009
    Posts
    22
    Thanks
    3
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default signal and slot passing data between a dialog and object, signal error

    Hi All,
    hope you can help out with this. I'm trying to connect a signal from a dialog to a object slot except it's reporting and error “QObject::connect: No such signal GameAddDialog::add_to_game_list_signal( struct symbolstruct element_to_add ) in”

    My dialog is show below

    Qt Code:
    1. namespace Ui {
    2. class GameAddDialog;
    3. }
    4. class GameAddDialog : public QDialog
    5. {
    6. Q_OBJECT
    7.  
    8. public:
    9. explicit GameAddDialog(QWidget *parent = 0);
    10. ~GameAddDialog();
    11. signals:
    12. void add_to_Game_list_signal( struct Gamestruct element_to_add );
    13. private slots:
    14. void on_pushButton_clicked();
    15. void on_pushButton_2_clicked();
    16. private:
    17. Ui::GameAddDialog *ui;
    18. };
    To copy to clipboard, switch view to plain text mode 

    my object is defined as
    Qt Code:
    1. typedef struct Gamestruct
    2. {
    3. /*name of symbol*/
    4. QString name_string;
    5.  
    6. }GAMESTRUCT;
    7. class GameObject : public QObject
    8. {
    9. Q_OBJECT
    10. public:
    11. explicit GameObject(QObject *parent = 0);
    12.  
    13. signals:
    14.  
    15. public slots:
    16. void add_to_Game_list_slot( struct Gamestruct element_to_add );
    17. private:
    18. std::vector <struct Gamestruct> Game_list;
    19.  
    20. };
    21. extern class GameObject GameObjectClass;
    To copy to clipboard, switch view to plain text mode 

    I connect the signal and slot after int the function below after I create the dialog.
    Qt Code:
    1. GameAddDialog mAddDialog;
    2. /*connect the signals and slots*/
    3. QObject::connect( &mAddDialog, SIGNAL( add_to_Game_list_signal( struct Gamestruct element_to_add ) ), &GameObjectClass, SLOT( add_to_Game_list_slot( struct Gamestruct element_to_add ) ) ); ***error line
    4. mAddDialog.setModal( true );
    5. mAddDialog.exec( );
    To copy to clipboard, switch view to plain text mode 

    The error occurs on the line Ive marked ***error.

    Can anyone advise? Is it something to do with the GameAddDialog not being global

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: signal and slot passing data between a dialog and object, signal error

    You have argument names in your SIGNAL and SLOT macros, they only take the method's signature (method name and types of arguments).

    Cheers,
    _

Similar Threads

  1. Replies: 9
    Last Post: 27th March 2014, 09:45
  2. Passing pointer to object that emits a signal
    By Gadgetman53 in forum Qt Programming
    Replies: 2
    Last Post: 17th April 2011, 21:04
  3. Passing data via signal/slot
    By gib in forum Qt Programming
    Replies: 4
    Last Post: 1st November 2010, 05:49
  4. Passing a pointer in Signal/Slot Connection
    By mclark in forum Qt Programming
    Replies: 4
    Last Post: 6th November 2007, 19:04
  5. Replies: 2
    Last Post: 17th May 2006, 21:01

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.