[Solved] Issue with insertRow



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


  • Lifetime Qt Champion

    Hi,

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



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.