Results 1 to 3 of 3

Thread: How to practically use QAbstractTableModel.submit\revert methods?

  1. #1
    Join Date
    Oct 2012
    Posts
    21
    Thanks
    1
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question How to practically use QAbstractTableModel.submit\revert methods?

    I'm trying to do a record-based in-grid editing with a QAbstractTableModel-descendant class and a QTableView. When the editing is finished, the model recieves a signal to it's submit() or revert() slots. But there are no parameters, so the model does not know which record it needs to submit to (refresh from) a datastore. I've tried to setup my own change tracking inside model's setData()/removeRows()/insertRows() methods, but I do not think it's an optimal solution. What is the right way to do it?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to practically use QAbstractTableModel.submit\revert methods?

    Why do you think it is not optimal solution?

    You have rely on these functions, and implement internal (internal to model) caching or working and saved copy concepts optimally.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Oct 2012
    Posts
    21
    Thanks
    1
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to practically use QAbstractTableModel.submit\revert methods?

    Well, revert\submit is called every time a user finishes editing of a row, and it's implicitly stated in the docs that "This function is typically used for row editing", yet it lacks such a simple thing like an index parameter, which whould make things so obvious and simple. So I've thought I was missing something. But I guess I was not - thanks for clarifying that.

Similar Threads

  1. Where to submit a bug?
    By hgiese in forum Qt Programming
    Replies: 11
    Last Post: 3rd September 2009, 15:25
  2. QItemSelectionModel::currentChanged and revert change
    By Lykurg in forum Qt Programming
    Replies: 5
    Last Post: 25th March 2009, 07:48
  3. Best places to submit your freeware?
    By tgreaves in forum Installation and Deployment
    Replies: 18
    Last Post: 8th March 2009, 21:20
  4. Replies: 1
    Last Post: 6th January 2009, 14:21

Tags for this Thread

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.