qlands
8th August 2011, 14:15
Hi,
I have a plugin library (like the QT plug-and-paint example) that contains a series of QWidgets to enter data.
The interface of the plugin has a pure virtual fuction called QWidget* impMainModules::loadScreen(QString pluginName) that returns a widget bases on a plugin name.
All worked fine until I wanted to create a QtableModel to use in some of the widgets:
class fieldInRowModel : public QAbstractTableModel
{
Q_OBJECT
public:
fieldInRowModel(QObject *parent=0);
~fieldInRowModel();
int rowCount(const QModelIndex & parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
void setDatabase (QSqlDatabase db);
private:
QSqlDatabase database;
};
Implemented as:
fieldInRowModel::fieldInRowModel(QObject *parent)
:QAbstractTableModel(parent)
{
}
fieldInRowModel::~fieldInRowModel()
{
}
int fieldInRowModel::rowCount(const QModelIndex &) const
{
return 0; //Test value
}
int fieldInRowModel::columnCount(const QModelIndex &) const
{
return 0; //Test value
}
QVariant fieldInRowModel::data(const QModelIndex &/*index*/, int /*role*/) const
{
return QVariant(); //Test value
}
void fieldInRowModel::setDatabase (QSqlDatabase db)
{
database = db;
}
fieldInRowModel is in a separate file called moduleclasses.h and cpp that are part of the plugin library project .
Now, with the inclusion of this class in the plugin library, I get the following error when the main application intents to load the plugin.
undefined symbol: _ZTV15fieldInRowModel
fieldInRowModel is internal for the library thus the main application should not know that it exists.
Any idea how to fix it?
Thanks a lot!
Carlos.
I have a plugin library (like the QT plug-and-paint example) that contains a series of QWidgets to enter data.
The interface of the plugin has a pure virtual fuction called QWidget* impMainModules::loadScreen(QString pluginName) that returns a widget bases on a plugin name.
All worked fine until I wanted to create a QtableModel to use in some of the widgets:
class fieldInRowModel : public QAbstractTableModel
{
Q_OBJECT
public:
fieldInRowModel(QObject *parent=0);
~fieldInRowModel();
int rowCount(const QModelIndex & parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
void setDatabase (QSqlDatabase db);
private:
QSqlDatabase database;
};
Implemented as:
fieldInRowModel::fieldInRowModel(QObject *parent)
:QAbstractTableModel(parent)
{
}
fieldInRowModel::~fieldInRowModel()
{
}
int fieldInRowModel::rowCount(const QModelIndex &) const
{
return 0; //Test value
}
int fieldInRowModel::columnCount(const QModelIndex &) const
{
return 0; //Test value
}
QVariant fieldInRowModel::data(const QModelIndex &/*index*/, int /*role*/) const
{
return QVariant(); //Test value
}
void fieldInRowModel::setDatabase (QSqlDatabase db)
{
database = db;
}
fieldInRowModel is in a separate file called moduleclasses.h and cpp that are part of the plugin library project .
Now, with the inclusion of this class in the plugin library, I get the following error when the main application intents to load the plugin.
undefined symbol: _ZTV15fieldInRowModel
fieldInRowModel is internal for the library thus the main application should not know that it exists.
Any idea how to fix it?
Thanks a lot!
Carlos.