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. How to loop through only the records that were changed (edited, new, to clear).
Forum Updated to NodeBB v4.3 + New Features

How to loop through only the records that were changed (edited, new, to clear).

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

    I'm using OnManualSubmit. Before Recording with submitAll () desire
    make a loop to cycle through only the records that were changed in some way.
    How do I detect those records?.
    For each record I find I need to know if it was: Edited, Added or will be Deleted.
    This is to make a special synchronization information.
    Thank you very much!

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Buckets
      wrote on last edited by
      #2

      you could create a record structure that contains a couple of booleans to determine whether or not something was edited, added, or will be deleted.

      ba ba ba
      ba na na na

      1 Reply Last reply
      0
      • S Offline
        S Offline
        solucionamos
        wrote on last edited by
        #3

        To find out if a record has been changed I tried with isGenerated but I would touch review all records of the table open. However, in some programming languages ​​GETNEXTMODIFIED (function) quickly locate only the records that have been modified without having to review all.

        I need to know the equivalent function in qt and brief example of its use.
        Thanks.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          ChrisW67
          wrote on last edited by
          #4

          There is no equivalent single function in Qt. You can iterate over rows and columns with QSqlTableModel::isDirty(). I am not sure how it deals with new or deleted rows.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            solucionamos
            wrote on last edited by
            #5

            @
            //I created a slot called my_data_edit associated with signal dataChanged:

            model= new QSqlTableModel(this);
            //etc.
            connect(model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(my_data_edit(const QModelIndex&, const QModelIndex&)));

            //...

            void Dialog::my_data_edit(const QModelIndex&x, const QModelIndex&) {
            //mark row in a field.
            }

            //I also write a check in add button.

            //Furthermore, in the delete button I add a record in a special table to keep log of deleted records.

            @

            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