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

QSqlTableModel : Event when data pushed to sql table ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 679 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.
  • R Offline
    R Offline
    rXpSwiss
    wrote on 17 Mar 2017, 10:22 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 17 Mar 2017, 22:53 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
      • V Offline
        V Offline
        VRonin
        wrote on 18 Mar 2017, 10:38 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 20 Mar 2017, 06:20
        1
        • V VRonin
          18 Mar 2017, 10:38

          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 20 Mar 2017, 06:20 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

          3/4

          18 Mar 2017, 10:38

          • Login

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