Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSqlTableModel read only
QtWS25 Last Chance

QSqlTableModel read only

Scheduled Pinned Locked Moved General and Desktop
sqlsqliteqsqltablemodel
2 Posts 2 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GrahamL
    wrote on last edited by
    #1

    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

    Thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved