thanks, I forgot the EditRole.
thanks, I forgot the EditRole.
3q for your help! I do as you do!
QVariant Model::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if (role == Qt::TextAlignmentRole)
{
return int(Qt::AlignRight | Qt::AlignVCenter);
}
else if (role == Qt:isplayRole)
{
// problem solved, I forgot the Qt::EditRole
return dataset[index.row()][index.column()];
}
else if(role == Qt::EditRole)
{
QString str = dataset[index.row()][index.column()];
return str;
}
return QVariant();
}
Bookmarks