Hi,
Before the tree view launches the editor of your delegate, for an item, it uses the
flags method of your model implementation to check if the item can be
edited, so you simply mustn't return the Qt::ItemIsEditable flag for the first column
of your model.
Here an example implementation of the flags method:
Qt::ItemFlags CMyModel::flags( const QModelIndex& idx ) const {
if(! idx.isValid( ) )
return Qt::ItemIsEnabled;
Qt::ItemFlags def = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
if( idx.column( ) == 0 )
return def;
return def | Qt::ItemIsEditable;
}
Qt::ItemFlags CMyModel::flags( const QModelIndex& idx ) const {
if(! idx.isValid( ) )
return Qt::ItemIsEnabled;
Qt::ItemFlags def = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
if( idx.column( ) == 0 )
return def;
return def | Qt::ItemIsEditable;
}
To copy to clipboard, switch view to plain text mode
Bookmarks