Results 1 to 5 of 5

Thread: "no matching function for call to 'UserCreationDialog::Connect(..."

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2015
    Posts
    28
    Thanks
    10
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default "no matching function for call to 'UserCreationDialog::Connect(..."

    Hi,

    I have two classes, UserConfiguration and UserCreationDialog, in my C++ Qt Project. I need to make a connection between a signal from UserCreationDialog, when OK button is pressed and the slot update() in UserConfiguration. The connection is seen in my code below. But when I build, I get the error:

    Qt Code:
    1. "[...] usercreationdialog.cpp:13: error: no matching function for call to 'UserCreationDialog::connect(UserCreationDialog*, const char*, UserConfiguration**, const char*)' connect(this, SIGNAL(updateUserConfig()),&uconf,SLOT(update()));"
    To copy to clipboard, switch view to plain text mode 
    ^

    UserCreationDialog.h
    Qt Code:
    1. #ifndef USERCREATIONDIALOG_H
    2. #define USERCREATIONDIALOG_H
    3. #include <QDialog>
    4.  
    5. class UserConfiguration;
    6.  
    7. namespace Ui {
    8. class UserCreationDialog;
    9. }
    10.  
    11. class UserCreationDialog : public QDialog
    12. {
    13. Q_OBJECT
    14.  
    15. public:
    16. explicit UserCreationDialog(QWidget *parent = 0);
    17. ~UserCreationDialog();
    18.  
    19. private slots:
    20. void on_buttonBox_accepted();
    21.  
    22. private:
    23. Ui::UserCreationDialog *ui;
    24. UserConfiguration *uconf;
    25. QSqlDatabase* fv_db;
    26.  
    27. signals:
    28. void updateUserConfig();
    29. };
    30.  
    31. #endif // USERCREATIONDIALOG_H
    To copy to clipboard, switch view to plain text mode 

    UserCreationDialog.cpp
    Qt Code:
    1. #include "usercreationdialog.h"
    2. #include "ui_usercreationdialog.h"
    3. #include "userconfiguration.h"
    4.  
    5. UserCreationDialog::UserCreationDialog(QWidget *parent) :
    6. QDialog(parent),
    7. ui(new Ui::UserCreationDialog)
    8. {
    9. ui->setupUi(this);
    10.  
    11. connect(this, SIGNAL(updateUserConfig()),&uconf,SLOT(update()));
    12. }
    13.  
    14. UserCreationDialog::~UserCreationDialog()
    15. {
    16. delete ui;
    17. }
    18.  
    19. void UserCreationDialog::on_buttonBox_accepted()
    20. {
    21. QString uid = ui->userIDLineEdit->text();
    22. QString pw = ui->passwordLineEdit->text();
    23. writeUserToDb(uid,pw, *fv_db);
    24. emit updateUserConfig();
    25. close();
    26. }
    To copy to clipboard, switch view to plain text mode 

    Some irrelevant code is left out from the shown code above.

    // Leutzig

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

    Default Re: "no matching function for call to 'UserCreationDialog::Connect(..."

    "uconf" already is a pointer, the & in your connect() call makes it a pointer to a pointer.

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 20th November 2015, 10:02
  2. Replies: 2
    Last Post: 26th November 2013, 16:48
  3. Replies: 2
    Last Post: 26th October 2013, 05:40
  4. Replies: 2
    Last Post: 23rd May 2012, 15:07
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

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.