Results 1 to 4 of 4

Thread: QTableView overwriting the editor with update

  1. #1
    Join Date
    Jul 2009
    Posts
    10
    Thanked 1 Time in 1 Post

    Default QTableView overwriting the editor with update

    I have a QTableView hooked up to a QAbstractTableModel. The data in the model is updated several times a second. I have one particular column setup for allowing editing. However, whenever the dataChanged signal is sent out indicating that values have changed, the value for EditRole is requested again and whatever you were typing is wiped out. Any thoughts on how to get around this? I need the edit control not to update while it is displaying.

  2. #2
    Join Date
    Jul 2009
    Posts
    10
    Thanked 1 Time in 1 Post

    Default Re: QTableView overwriting the editor with update

    Looks like a version of this has been answered:

    http://www.qtcentre.org/threads/1165...rneath-changes

  3. #3
    Join Date
    Jul 2009
    Posts
    10
    Thanked 1 Time in 1 Post

    Default Re: QTableView overwriting the editor with update

    I'm wrong. That tells you how to update the edit widget with updated data. That seems to be happening automatically for me and I need it to stop. Any ideas?

  4. #4
    Join Date
    Jul 2009
    Posts
    10
    Thanked 1 Time in 1 Post

    Default Re: QTableView overwriting the editor with update

    In the end, I built my own custom delegate. I have a flag that controls whether setEditorData() sets data on the editor or not. Every time createEditor() is called, it sets the flag to true. The next time setEditorData() is called, it will set the data on the editor, since it is a new editor, and the set the flag to false in order to stop subsequent value changes to the editor.

    If there is an easier way, I'd love to know it.

Similar Threads

  1. Replies: 0
    Last Post: 2nd March 2010, 18:06
  2. How to Add Text to Editor in QTableView
    By klahey in forum Qt Programming
    Replies: 2
    Last Post: 2nd January 2010, 15:05
  3. QTableView update
    By inktomi in forum Qt Programming
    Replies: 4
    Last Post: 16th July 2009, 15:18
  4. QFile Seeking / Overwriting
    By tntcoda in forum Qt Programming
    Replies: 3
    Last Post: 13th November 2008, 19:02
  5. Replies: 2
    Last Post: 5th February 2008, 14:58

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.