Results 1 to 6 of 6

Thread: How to remove row from Model without removing from source

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2010
    Posts
    107
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default How to remove row from Model without removing from source

    I have a tableView created from a QSqlRelationalTableModel and a proxy model. I use the table to let the user display data to their needs. I use the proxyModel to highlight the high and low values in a column. The user needs to be able to sort the table and remove certain rows. BUT I don't want the underlying source to be modified. I tried to remove the row from the model, but it removed it from the source as well. I tried to hide the row, but then if the user sorted the column, the hidden data becomes available. What would be the best way to do this? The table is not going to be very big. If there isn't a better method, one idea I had was to create another table in my database and store the "original" data (the filtered data from the SQLRelation and filtered data) when the dialog is created. Then if the user wants to revert back to the original data, the dialog could "DROP" the table, Create the table again and repopulate the table row by row. This way the original data would be intact. Is there a method to remove items from a model/view without removing them from the source?

  2. #2
    Join Date
    Sep 2008
    Location
    Poland
    Posts
    80
    Thanks
    4
    Thanked 5 Times in 4 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: How to remove row from Model without removing from source

    removeRow() and editStrategy:: onManualSubmit shoud do the work done Brother ;]

Similar Threads

  1. Replies: 2
    Last Post: 21st March 2012, 14:30
  2. QFileSystemModel::remove not removing index from model
    By revorgm in forum Qt Programming
    Replies: 1
    Last Post: 27th February 2011, 09:24
  3. Flat data source for QTreeView/Model
    By mawt in forum Qt Programming
    Replies: 1
    Last Post: 18th October 2009, 16:20
  4. removing model Items
    By gyre in forum Newbie
    Replies: 2
    Last Post: 25th November 2007, 20:10
  5. Removing rows from table model
    By steg90 in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2007, 20:36

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
  •  
Qt is a trademark of The Qt Company.