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. if insertRecord is the way to update a row how do I find the row number of the model? For instance, I just inserted a new record, what is the row number so I can call insertRecord to update the new record?

if insertRecord is the way to update a row how do I find the row number of the model? For instance, I just inserted a new record, what is the row number so I can call insertRecord to update the new record?

Scheduled Pinned Locked Moved Unsolved General and Desktop
modelview
2 Posts 2 Posters 210 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.
  • J Offline
    J Offline
    jdent
    wrote on 21 Mar 2024, 15:32 last edited by
    #1

    I have not found anything remotely similar to updateRecord() in a model! I} assume we are to use insertRecord() but with what row number?

    i have a QTableView with a current row -- how do I find which is the row number of the model so I can call insertRecord??

    A 1 Reply Last reply 21 Mar 2024, 16:27
    0
    • J jdent
      21 Mar 2024, 15:32

      I have not found anything remotely similar to updateRecord() in a model! I} assume we are to use insertRecord() but with what row number?

      i have a QTableView with a current row -- how do I find which is the row number of the model so I can call insertRecord??

      A Offline
      A Offline
      Axel Spoerl
      Moderators
      wrote on 21 Mar 2024, 16:27 last edited by
      #2

      @jdent
      I am not exactly sure, what

      update the new record

      means. Update an existing record, or insert a new one?
      insertRecord()adds a new record to your table model. It doesn't do anything with the record's data.

      but with what row number

      That depends.
      currentIndex()is the currently selected index of any QAbstractItemView. It has a column()and a row().
      indexAt()will return the model index at a given point on the screen.
      indexWidget()returns the pointer to a widget, in case you have set one.
      In the model itself, you have plenty of accessors to retrieve or set item data to a given model index. All of those examples can be used to modify existing records (actually: indexes).

      Software Engineer
      The Qt Company, Oslo

      1 Reply Last reply
      2

      2/2

      21 Mar 2024, 16:27

      • Login

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