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 don't set Dirty Flag..

QSqlTableModel don't set Dirty Flag..

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.1k 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.
  • Z Offline
    Z Offline
    zither
    wrote on last edited by
    #1

    Dear all,

    I delete row remove from QSqlTableModel but it doesn't show dirty flag & submitAll() doesn't work..
    What's wrong with my code?

    @QSqlTableModel.removeRow(1);
    QSqlTableModel.isDirty(); //return false
    QSqlTableModel.submitAll(); //No changes to database@

    Thanks

    1 Reply Last reply
    0
    • L Offline
      L Offline
      loladiro
      wrote on last edited by
      #2

      Doesn't "isDirty":http://doc.qt.nokia.com/4.8-snapshot/qsqltablemodel.html#isDirty take a QModelIndex?
      What does submitAll return?
      Is your code really like QSqlTableModel.submitAll();?
      Because that doesn't seem to be valid C++ code.

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zither
        wrote on last edited by
        #3

        Oh, sorry
        Actually..
        @QSqlTableModel.isDirty(QModelIndex())@

        Can it detect the whole table?

        Thanks

        1 Reply Last reply
        0
        • L Offline
          L Offline
          loladiro
          wrote on last edited by
          #4

          Not that way
          [quote]
          If index is invalid or points to a non-existing row, false is returned.
          [/quote]
          You could listen to the dataChanged() signal however.

          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