错误:no matching function for call to setupUi
按照《C++ GUI Qt4编程》做那个对话框程序结果出错,用的是Qt Creator,
#include <QApplication>#include <QDialog>#include"ui_gotocelldialog.h"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();}
#ifndef UI_GOTOCELLDIALOG_H#define UI_GOTOCELLDIALOG_H#include <QtCore/QVariant>#include <QtGui/QAction>#include <QtGui/QApplication>#include <QtGui/QButtonGroup>#include <QtGui/QDockWidget>#include <QtGui/QHBoxLayout>#include <QtGui/QHeaderView>#include <QtGui/QLabel>#include <QtGui/QLineEdit>#include <QtGui/QPushButton>#include <QtGui/QSpacerItem>#include <QtGui/QVBoxLayout>#include <QtGui/QWidget>QT_BEGIN_NAMESPACEclass Ui_GoToCellDialog{public: QWidget *dockWidgetContents; QVBoxLayout *verticalLayout; QHBoxLayout *horizontalLayout; QLabel *label; QLineEdit *lineEdit; QHBoxLayout *horizontalLayout_2; QSpacerItem *horizontalSpacer; QPushButton *pushButton; QPushButton *pushButton_2; void setupUi(QDockWidget *GoToCellDialog) { …… } // setupUi void retranslateUi(QDockWidget *GoToCellDialog) { GoToCellDialog->setWindowTitle(QApplication::translate("GoToCellDialog", "GoToCell", 0, QApplication::UnicodeUTF8)); label->setText(QApplication::translate("GoToCellDialog", "&Cell", 0, QApplication::UnicodeUTF8)); pushButton->setText(QApplication::translate("GoToCellDialog", "OK", 0, QApplication::UnicodeUTF8)); pushButton_2->setText(QApplication::translate("GoToCellDialog", "Cancel", 0, QApplication::UnicodeUTF8)); } // retranslateUi};namespace Ui { class GoToCellDialog: public Ui_GoToCellDialog {};} // namespace UiQT_END_NAMESPACE#endif // UI_GOTOCELLDIALOG_H