You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Tuesday, September 22nd 2009, 12:54pm

error no matching function for call to ‘Ui::GoToCellDialog::setupUi(QDialog*&)’

hey, i was creating the this application:

goto-cell.pro (automatic generated by qmake)

Source code

1
  p, li { white-space: pre-wrap; }  # ##################################################################### # Automatically generated by qmake (2.01a) Tue Sep 22 12:07:41 2009 # ##################################################################### TEMPLATE = app TARGET =  DEPENDPATH += . INCLUDEPATH += .  # Input FORMS += gotocelldialog.ui SOURCES += main.cpp HEADERS += ui_gotocelldialog.h

gotocelldialog.ui
main.cpp

Source code

1
  p, li { white-space: pre-wrap; }  #include "ui_gotocelldialog.h" #include <QApplication> #include <QDialog> int main(int argc, char *argv[]) {     QApplication app(argc, argv);     Ui::GoToCellDialog ui;     QDialog *dialog = new QDialog;     ui.setupUi(dialog);     dialog->show();     return app.exec(); }

ui_gotocelldialog.h (automatic generated by qmake)


this is the example from the book: c++ gui programming with Qt 4 i've all like they have, but it gives me this error:
main.cpp:9: error: no matching function for call to ‘Ui::GoToCellDialog::setupUi(QDialog*&;)
line9:

Source code

1
  p, li { white-space: pre-wrap; }      QDialog *dialog = new QDialog;     ui.setupUi(dialog);


/home/ralph/teste/Goto-cell/goto-cell/ui_gotocelldialog.h:50: note: candidates are: void Ui_GoToCellDialog::setupUi(QMainWindow*)
line50:

Source code

1
  p, li { white-space: pre-wrap; }  void setupUi(QMainWindow *GoToCellDialog)



hope u can help

cheers :S

jjamfd

Beginner

  • "jjamfd" is male

Posts: 7

Location: New York City

Occupation: UNIX/Linux System Admin

  • Send private message

2

Friday, September 25th 2009, 5:00pm

I have re-posted your code so it is easier to read, I can't see anything wrong.

Can you post the contents of your gotocelldialog.ui file?



Source code

1
2
3
4
5
6
7
8
9
10
# Automatically generated by qmake (2.01a) Tue Sep 22 12:07:41 2009
# ##################################################################### 
TEMPLATE = app 
TARGET =  
DEPENDPATH += . 
INCLUDEPATH += .  
# Input 
FORMS += gotocelldialog.ui 
SOURCES += main.cpp 
HEADERS += ui_gotocelldialog.h


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
#include "ui_gotocelldialog.h" 
#include <QApplication> 
#include <QDialog> 

int main(int argc, char *argv[]) 
{     
    QApplication app(argc, argv);     
    Ui::GoToCellDialog ui;     
    QDialog *dialog = new QDialog;     
    ui.setupUi(dialog);     
    dialog->show();     
    return app.exec(); 
}
"The last thing one knows when constructing a work is what to put first." - Blaise Pascal

3

Tuesday, January 4th 2011, 2:40am

I encountered the same error yesterday.

I find out error happens because I create the window from the "QT creator" not "designer".

The QT creator create a "QMainWindow" that doesn't match the "QDialog".

Hope this will be helpful.