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. [Solved] Issue with insertRow
QtWS25 Last Chance

[Solved] Issue with insertRow

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 650 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.
  • L Offline
    L Offline
    lukeQt
    wrote on last edited by lukeQt
    #1

    Hi Everyone,

    I have a QtSql.QSqlRelationalTableModel and a tableView. I can insertRows just fine. If the index is not valid though a blank row is added to the view, but not the model. How do you prevent adding a row to the view if no row is added to the model first? Correct me if I am wrong but insertRow adds a row to the view first and then to the model. This happens when the user does not specify a value in the tablemodel. How can you validate that the user has specified a value before adding another row. I was looking at dataChanged, but was not sure how to use this.

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

      Hi,

      It depends on how you submit the data to the database. Which mode are you using ?

      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
      0
      • L Offline
        L Offline
        lukeQt
        wrote on last edited by
        #3

        I was using the default submit mode which I believe is the OnFieldChange. I guess then I need to use the OnManualSubmit.

        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