problem in declaring QDirModel
I write a class which is extended from QWidget and Now i declare a QDirModel object in .h file and it instantiated in My class contructor... when i compile it gives the following error.. I include all the things whic are necessary..
Quote:
model.h:18: error: ISO C++ forbids declaration of 'QDirModel' with no type
model.h:18: error: expected ';' before '*' token
model.cpp: In constructor 'DirModel::DirModel(QWidget*)':
model.cpp:10: error: 'iModel' was not declared in this scope
model.cpp:10: error: expected type-specifier before 'QDirModel'
model.cpp:10: error: expected `;' before 'QDirModel'
model.cpp: At global scope:
code is :
Code:
{
public:
~DirModel();
void AddFolder(const QString& aFolderName,int aParent = 0);
public:
int iFolderId;
};
DirModel
::DirModel(QWidget* aParent
){
iModel->setReadOnly(false);
iView->setModel(iModel);
iView
->setRootIndex
( iModel
->index
(QString( "/home/randy" ) ) );
}
DirModel::~DirModel()
{
}
void DirModel::AddFolder(const QString& aFolderName,int aParent)
{
// iModel->mkdir(aParent,aFolderName);
}
Re: problem in declaring QDirModel
You should add
Before DirModel class declaration. Or just include it.
Re: problem in declaring QDirModel
i try the above two options
class QDirModel;
and also i include that header file...
even it gives the same errors above shown.
Re: problem in declaring QDirModel
Could you attach the header and source file or something? Then we can spot it immediately. Otherwise we just have to keep guessing.