主文件:
#include <qapplication.h>
#include "imageprocess.h"
int main( int argc, char **argv )
{
QApplication a( argc, argv );
ImageProcess *w =
new ImageProcess(0, "new window", Qt::WA_DeleteOnClose);
w->setWindowTitle("Image Process"); const char* winName="new window";
w->show();
QObject::connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()));
return a.exec();
}
ImageProcess类的定义在imageprocess.h中:
#ifndef IMAGEPROCESS_H
#define IMAGEPROCESS_H
#include <qvariant.h>
#include <qmainwindow.h>
#include <qimage.h>
#include <qpixmap.h>
#include <QList>
#include <QWidget>
#include "tooldialog.h"
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QAction;
class QActionGroup;
class QToolBar;
class QPopupMenu;
class ImageProcess : public QMainWindow
{
Q_OBJECT
public:
ImageProcess( QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = 0 );
~ImageProcess();
……
}
编译提示错误:
main.cpp: In function 'int main(int, char**)':
main.cpp:10: error: no matching function for call to 'ImageProcess::ImageProcess(int, const char [11], Qt::WidgetAttribute, int)'
imageprocess.h:34: note: candidates are: ImageProcess::ImageProcess(QWidget*, const char*, Qt::WindowFlags)
imageprocess.h:30: note: ImageProcess::ImageProcess(const ImageProcess&)
请问这是什么原因?感觉这样创建对象没错阿