QTableview set column data unchanged
-
Hi,
I am using Qtableview (QAbstractItemModel)
I have two Qtableview tables ,, so in table2 I want one column(column name =Column_A) as :
A. if there is not data in Column_A in any row that type user can enter data
B. if user entered data in Column_A once then he should not be allow to change
the data.(like if user type also then it should reset to prev data)
C. if data in Column_A is coming from table1 column then it should show same
data , if user change data in table1 column then also it should display same and not allow to chnge data in table2 Column_AHow to do this ?? basically how should I apply CONDITION B ?
-
Hi,
You can make the cell uneditable after it has been edit.
-
@n-2204
Qt::ItemFlags QAbstractItemModel::flags(const QModelIndex &index) const. Among the flags Qt::ItemFlags isQt::ItemIsEditable
, which you should mask out on indexes once they have been edited. You will obviously need to store somewhere which indexes have been edited.