Unsolved Qtableview
-
How do i make a particular column of a Qtableview model editable ?
-
@Amogh hi,friend,welcome.
you can use the
editorfactory
forsame value type
cell item. and delegate for column.particular value type
Qt Itemviews color editor factpry
editable just for column
Two ways:
- when you new cell item, set the item is editable.
- set delegate just for this column, and you should to finished new editor widget in delegate.model-view-delegate
-
By default it is editable only. It shows you the lineEdit by default. Any other specific stuff r u trying to do ?
-
It's not just up to the View.
- You can make sure the view has some edit triggers set: http://doc.qt.io/qt-5/qabstractitemview.html#editTriggers-prop
- The delegate has to handle the editing (this only applies if you set a custom delegate)
- The model
flags()
method must return a value withQt::ItemIsEditable
set and itssetValue
method must actually do something rather than just returningfalse
For example, if you are trying to edit a
QSqlQueryModel
via aQTableView
you won't be successful as the 3rd point is failing