QSqlTableModel : Event when data pushed to sql table ?



  • Hello,

    I am looking to do the following :
    Always have an empty cached row at the button of the table. When the user enters something in it and validates it (with Enter/Return) I want a new row to be added so there is always an empty row at the bottom.

    beforeInsert or primeInsert doesn't work for that, I tried to catch the return key but I will catch it too fast and won't be able to add a line before the data is submit.

    What should I use ?

    rXpSwiss


  • Lifetime Qt Champion

    Hi,

    What about having a proxy model ?



  • Doable but not straightforward.
    When would you want the data to be pushed to the main table? For example: imagine you have 2 columns of the table that require non-null values, you can't just send the row to the QSqlTableModel if the user inserts just one of those value so how would you manage it?



  • @VRonin said in QSqlTableModel : Event when data pushed to sql table ?:

    Doable but not straightforward.
    When would you want the data to be pushed to the main table? For example: imagine you have 2 columns of the table that require non-null values, you can't just send the row to the QSqlTableModel if the user inserts just one of those value so how would you manage it?

    In this case there is no non-null value. So if the user submit a single cell and then submit the next one it's okey.

    Otherwise I could put some button that says "apply", etc.


Log in to reply
 

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