ob019
17th April 2008, 15:38
Hello everybody,
i am a newbie in using the MVC-Classes of QT4. (4.3.4) I have got the following problem:
I provide an implementation of QAbstactItemModel named MyModel. This Model works fine.
class MyModel : public QAbstractItemModel
{
Q_OBJECT
public:
MyModel( const QString &filename, QObject* parent = 0 );
~MyModel();
/*
** AbstractItemModel(required methods)
*/
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole ) const;
QModelIndex index(int row, int col, const QModelIndex &parent = QModelIndex() ) const;
QModelIndex parent(const QModelIndex &index ) const;
int rowCount(const QModelIndex &parent = QModelIndex() ) const;
int columnCount(const QModelIndex &parent = QModelIndex() ) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
bool setData(const QModelIndex &index, const QVariant &value,
int role = Qt::EditRole);
private:
void setupModel();
.
.
.
};
Now I want to subclass from this bassclass to create a new model called MyTXTModel.
class MyTXTModel : MyModel
{
Q_OBJECT
public:
MyTXTModel(const QString& filename, QObject *parent = 0);
~MyTXTModel();
private:
.
.
.
};
But this model doesn't work. I get several errors from the linker:
MyTXTModel.obj : error LNK2019: link to unresolved external symbol ""public: __thiscall MyModel::MyModel(class QString const &,class QObject *)" (??0MyModel@@QAE@ABVQString@@PAVQObject@@@Z)" in function ""public: __thiscall MyTXTModel::MyTXTModel(class QString const &,class QObject *)" (??0MyTXTModel@@QAE@ABVQString@@PAVQObject@@@Z)".
MyTXTModel.obj : error LNK2001: unresolved external symbol ""public: virtual class QModelIndex __thiscall MyModel::index(int,int,class QModelIndex const &)const " (?index@MyModel@@UBE?AVQModelIndex@@HHABV2@@Z)".
.
.
.
Does anybody have a solution for this problem???
Kind regards
i am a newbie in using the MVC-Classes of QT4. (4.3.4) I have got the following problem:
I provide an implementation of QAbstactItemModel named MyModel. This Model works fine.
class MyModel : public QAbstractItemModel
{
Q_OBJECT
public:
MyModel( const QString &filename, QObject* parent = 0 );
~MyModel();
/*
** AbstractItemModel(required methods)
*/
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole ) const;
QModelIndex index(int row, int col, const QModelIndex &parent = QModelIndex() ) const;
QModelIndex parent(const QModelIndex &index ) const;
int rowCount(const QModelIndex &parent = QModelIndex() ) const;
int columnCount(const QModelIndex &parent = QModelIndex() ) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
bool setData(const QModelIndex &index, const QVariant &value,
int role = Qt::EditRole);
private:
void setupModel();
.
.
.
};
Now I want to subclass from this bassclass to create a new model called MyTXTModel.
class MyTXTModel : MyModel
{
Q_OBJECT
public:
MyTXTModel(const QString& filename, QObject *parent = 0);
~MyTXTModel();
private:
.
.
.
};
But this model doesn't work. I get several errors from the linker:
MyTXTModel.obj : error LNK2019: link to unresolved external symbol ""public: __thiscall MyModel::MyModel(class QString const &,class QObject *)" (??0MyModel@@QAE@ABVQString@@PAVQObject@@@Z)" in function ""public: __thiscall MyTXTModel::MyTXTModel(class QString const &,class QObject *)" (??0MyTXTModel@@QAE@ABVQString@@PAVQObject@@@Z)".
MyTXTModel.obj : error LNK2001: unresolved external symbol ""public: virtual class QModelIndex __thiscall MyModel::index(int,int,class QModelIndex const &)const " (?index@MyModel@@UBE?AVQModelIndex@@HHABV2@@Z)".
.
.
.
Does anybody have a solution for this problem???
Kind regards