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?
Forum Updated to NodeBB v4.3 + New Features

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 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

    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??

    Axel SpoerlA 1 Reply Last reply
    0
    • J jdent

      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??

      Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote on 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

      • Login

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