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. Update a row in a QSqlTableModel
Forum Updated to NodeBB v4.3 + New Features

Update a row in a QSqlTableModel

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 5.4k 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.
  • F Offline
    F Offline
    freecamellia
    wrote on last edited by
    #1

    I want to use the updateRowInTable() method to update a row in a QSqlTableModel and so the database table.
    Knowing the method is virtual protected, how to use it?! is like this?

    @tableModel->updateRowInTable(givenRow, myRecord);@

    1 Reply Last reply
    0
    • K Offline
      K Offline
      KA51O
      wrote on last edited by
      #2

      Please read the "documentation":http://developer.qt.nokia.com/doc/qt-4.7/qsqltablemodel.html.

      bq. Updates the given row in the currently active database table with the specified values. Returns true if successful; otherwise returns false.
      This is a low-level method that operates directly on the database and should not be called directly. Use setData() to update values. The model will decide depending on its edit strategy when to modify the database.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        freecamellia
        wrote on last edited by
        #3

        it generates an error that tell me that the method is protected

        1 Reply Last reply
        0
        • K Offline
          K Offline
          KA51O
          wrote on last edited by
          #4

          thats because you can't use a "protected":http://msdn.microsoft.com/en-us/library/e761de5s.aspx method outside of its related class.

          1 Reply Last reply
          0
          • F Offline
            F Offline
            freecamellia
            wrote on last edited by
            #5

            Where are @Volker and @Andre?

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              [quote author="freecamellia" date="1323943430"]Where are @Volker and @Andre?[/quote]
              Here, but neither of us is your personal Qt consultant (at least, not that I know of) :-)

              Edit:
              On topic then: I think you should heed the warning in the documentation of that method, that it should not be called directly and that you should use setData(). If you want to do it in another way, fine, but don't expect help on doing that unless you have a very, very good reason for it. And no, "I think this is easier" does not qualify.

              1 Reply Last reply
              0
              • F Offline
                F Offline
                freecamellia
                wrote on last edited by
                #7

                I am a computer science's engineering student, I have been learning Qt for the last 2-3 month so I am a beginner in Qt. My purpose in this moment is just to learn, so I make the most of your forum.

                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