How to make rows sticky during edit?



  • Here's my problem. I have a custom model that I represent via a QTreeView. I run this model through several sort/filter proxy models before connecting the final proxy model to the QTreeView. Then the user has the ability to choose various filters and the TreeView updates automatically.

    I want to give the user the ability to edit certain parts of each row using an editor. This is the easy part. The hard part is this. Those rows are active rows, they represent downloading packages. So if the user has selected the "Downloading" filter, starts editing and the item represented by the row finishes downloading during the edit, the row disappears the the editing is aborted.

    I need a way to make a row sticky when being edited. Is there a way?

    (I was thinking of detecting the View's state but my delegate, which controls the 'downloading' status doesn't have access to the view AFAIK. )



  • Hi,
    Isn't this more a thing for the model? The model supplies the delegate and controls the shown data. Maybe in the model check if the delegate is active and check on what row. If the 'completed' download should be updated (signal in model), abort this when the delegate is set to that item. When the user is done editing and the setData is called there will be an update to that row anyway.



  • How do I do that? AFAIK the Model doesn't have any knowledge of the delegate. The delegate is set on the View with QAbstractItemView::setItemDeletgate().


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.