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. how do I update the current row in the model?
Forum Updated to NodeBB v4.3 + New Features

how do I update the current row in the model?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 223 Views 1 Watching
  • 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.
  • J Offline
    J Offline
    jdent
    wrote on last edited by
    #1

    Hi,

    I have a model attached to a QTableView. I assume insertRecord() is the way to update records since I can't find updateRecord. How do I find what is the model's row number that is currently selected in the QTableView so I can update it?

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

      Hi,

      Use currentIndex. From there you can extract all the information you need to update the model content.

      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
      • J jdent

        Hi,

        I have a model attached to a QTableView. I assume insertRecord() is the way to update records since I can't find updateRecord. How do I find what is the model's row number that is currently selected in the QTableView so I can update it?

        JonBJ Online
        JonBJ Online
        JonB
        wrote on last edited by
        #3

        @jdent said in how do I update the current row in the model?:

        since I can't find updateRecord.

        For that part, at the QSqlRecord level, it's bool QSqlTableModel::setRecord(int row, const QSqlRecord &values).

        1 Reply Last reply
        0

        • Login

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