/////////////////////////////////////////////////////getItem.h
#ifndef GETITEM_H
#define GETITEM_H
#include<QDialog>
#include"ui_getItem.h"
#include<QtUiTools>
namespace Ui
{
class getItem;
}
class getItem:public QDialog
{
Q_OBJECT
public:
getItem();
~getItem();
private slots:
void finish();
private:
Ui::getItem *getGetItem;
};
#endif // GETITEM_H
/////////////////////////////////////////getItem.cpp
#include "getItem.h"
//#include "ui_getItem.h"
#include<QDate>
getItem::getItem()
:QDialog(),getGetItem(new Ui::getItem)
{
this->setModal(true);
getGetItem->setupUi(this);
(getGetItem->getDateEdit)->setDate(QDate::currentDate());
connect(getGetItem->buttonBox,SIGNAL(accepted()),this,SLOT(finish()));
connect(getGetItem->buttonBox,SIGNAL(rejected()),this,SLOT(finish()));
}
getItem::~getItem()
{
// delete getGetItem;
}
void getItem::finish()
{
}
然后还有一个叫getItem.ui的文件。mian 函数什么的都是测试无误的。
但是报错:
Running build steps for project financeQt...
Starting: /home/shifan/public/qt/qt/bin/qmake /home/shifan/document/cpp/financeQt/financeQt/financeQt.pro -spec linux-g++ -r CONFIG+=debug
Exited with code 0.
Starting: /usr/bin/make -w
make: Entering directory `/home/shifan/document/cpp/financeQt/financeQt'
g++ -c -pipe -g -D_REENTRANT -Wall -W -DQT_SQL_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../../public/qt/qt/mkspecs/linux-g++ -I. -I../../../../public/qt/qt/include/QtUiTools -I../../../../public/qt/qt/include/QtCore -I../../../../public/qt/qt/include/QtGui -I../../../../public/qt/qt/include/QtXml -I../../../../public/qt/qt/include/QtSql -I../../../../public/qt/qt/include -I. -I. -o getItem.o getItem.cpp
make: Leaving directory `/home/shifan/document/cpp/financeQt/financeQt'
getItem.cpp: In constructor ‘getItem::getItem()’:
getItem.cpp:5: 错误:invalid use of incomplete type ‘struct Ui::getItem’
getItem.h:9: 错误:forward declaration of ‘struct Ui::getItem’
getItem.cpp:8: 错误:invalid use of incomplete type ‘struct Ui::getItem’
getItem.h:9: 错误:forward declaration of ‘struct Ui::getItem’
getItem.cpp:9: 错误:invalid use of incomplete type ‘struct Ui::getItem’
getItem.h:9: 错误:forward declaration of ‘struct Ui::getItem’
getItem.cpp:11: 错误:invalid use of incomplete type ‘struct Ui::getItem’
getItem.h:9: 错误:forward declaration of ‘struct Ui::getItem’
getItem.cpp:12: 错误:invalid use of incomplete type ‘struct Ui::getItem’
getItem.h:9: 错误:forward declaration of ‘struct Ui::getItem’
make: *** [getItem.o] 错误 1
Exited with code 2.
Error while building project financeQt
When executing build step 'Make'
不知道是什么原因,困扰了我一晚上。