Hi everybody,
I defined my own TableModel using the QAbstractTableModel class...all run perfectly just i couldn't use the rowCount method in my program :
"no Matching function for call to TableModel::rowCount const"
"condidates are virtual int TableModel::rowCount const"
i'm sure that i have defined correctly the virtual method but i don't know what happened ? i have also changed the example of adresse book:
{
if (!index.isValid())
if (index.row() >= /*listOfPairs.size()*/ rowCount() || index.row() < 0)
if (role == Qt::DisplayRole) {
QPair<QString, QString> pair = listOfPairs.at(index.row());
if (index.column() == 0)
return pair.first;
else if (index.column() == 1)
return pair.second;
}
}
QVariant TableModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if (index.row() >= /*listOfPairs.size()*/ rowCount() || index.row() < 0)
return QVariant();
if (role == Qt::DisplayRole) {
QPair<QString, QString> pair = listOfPairs.at(index.row());
if (index.column() == 0)
return pair.first;
else if (index.column() == 1)
return pair.second;
}
return QVariant();
}
To copy to clipboard, switch view to plain text mode
same fact !!
any idea ??
Bookmarks