Qt World Summit: Register Today!

QSqlTableModel read only

  • Hi
    I have a QSqlTableModel which I use to populate a table view, but I need that some cells are read only.
    In the past when I have used MV architecture I had my own model and overrode the flags member to set an index as read only.
    My aim is to have several views of the table (not necessarily table views) so I need the read only status to be in the model not the view.

    I would be grateful if anyone has any suggestions as to how I can achieve this


  • Lifetime Qt Champion


    You can to the same here, subclass QSqlTableModel and reimplement the flags function