Hello!
Here is what i have so far:
{
public:
}
Qt
::ItemFlags flags
( const QModelIndex & index
) const {
if (index.column() == 1 || index.column() == 2)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
else
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
{
return 3;
}
{
}
};
class Manifest : public QSqlTableModel
{
public:
Manifest(QObject * parent = 0, QSqlDatabase db = QSqlDatabase() ):
QSqlTableModel(parent, db){
}
Qt::ItemFlags flags ( const QModelIndex & index ) const
{
if (index.column() == 1 || index.column() == 2)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
else
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
int columnCount(const QModelIndex &/*parent*/) const
{
return 3;
}
QVariant data(const QModelIndex &index, int role) const
{
return QSqlTableModel::data(index, role);
}
};
To copy to clipboard, switch view to plain text mode
This is my WIP.
I reimplemented flags so that only certain indexes can be edited.
I am currently trying to override the "data", because i want to put a checkbox on it.
Are there any sites wherein can i see the implementations? It's kinda hard if i can't see the underlying implementations.
Bookmarks