Results 1 to 2 of 2

Thread: QSqlTableModel doesn't delete the rows

  1. #1
    Join Date
    Sep 2014
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default QSqlTableModel doesn't delete the rows

    I have this piece of code:
    Qt Code:
    1. for (std::size_t i=0; i<m_rowsToDelete.size(); ++i)
    2. {
    3. qDebug() << m_rowsToDelete[i] << m_tableModelDB->removeRow(m_rowsToDelete[i]);
    4. }
    5.  
    6. m_db.transaction();
    7. bool a = m_tableModelDB->submitAll();
    8. qDebug() << "submitAll() =>" << a;
    9. m_db.commit();
    To copy to clipboard, switch view to plain text mode 
    I get true everywhere but the rows are not deleted from database.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QSqlTableModel doesn't delete the rows

    That's very nice, but how are we supposed to tell you what is wrong when you give us 9 lines of code and no information about what your variables are or where this code lives in your project or even how execution got to this code? My crystal ball isn't working today.

Similar Threads

  1. delete row from QSqlTableModel in QTableView
    By pippo42 in forum Qt Programming
    Replies: 7
    Last Post: 10th September 2014, 19:20
  2. Replies: 3
    Last Post: 17th July 2013, 05:07
  3. Replies: 0
    Last Post: 11th October 2012, 10:25
  4. Sum of rows in QSqlTableModel
    By aekilic in forum Qt Programming
    Replies: 2
    Last Post: 24th October 2010, 20:05
  5. QSqlTableModel inserts empty rows
    By Nesbitt in forum Qt Programming
    Replies: 2
    Last Post: 6th August 2008, 12:47

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.