Editing a TableModel
I have a MyClassTableModel that inherit from QAbstractTableModel then I set the model to a TableView. I want to edit the cells so I only have reimplemented flag() and setData() but does not work.
It needed something else?
what's your edit trigger configuration? Usually, items react to double-click, but you can configure the triggers to react to single click, focus change. etc.
also: if you try to edit an item, check the application output in your IDE. If editing fails due to missing flags or such, there should be a message saying "editing failed".
You can look in "Subclassing QAbstractTableModel":http://qt-project.org/doc/qt-4.8/QAbstractTableModel.html#subclassing
Also you can change the EditTriggers using
Thank you for your answers!
I have the following code (Ruby syntax)
class ObjectTableModel < Qt::AbstractTableModel
def setData(index, value, role = Qt::EditRole)
And then in a widget:
class GUICustomerWidget < Qt::Widget
when I click on a row there is no an output error.
I have for many days trying and reading forums and pages.
your edit trigger says 'double click'. Have you tried double-clicking an item? Simply clicking it won't trigger the edit mode.
you could try this:
This should allow you to enter edit mode with a single click.
rschaub I tried add this line too but nothing...
I pasted my code (simplified) "here":http://paste.ideaslabs.com/show/npRYMkeMqC if you want to see it in detail.