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. QSqlTableModel : Event when data pushed to sql table ?
QtWS25 Last Chance

QSqlTableModel : Event when data pushed to sql table ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 674 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.
  • R Offline
    R Offline
    rXpSwiss
    wrote on last edited by
    #1

    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

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

      Hi,

      What about having a proxy model ?

      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
      1
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #3

        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?

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        R 1 Reply Last reply
        1
        • VRoninV VRonin

          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?

          R Offline
          R Offline
          rXpSwiss
          wrote on last edited by
          #4

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

          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