Can I avoid a list-item in ListView visually move?
-
I have a ListView which is backed by a QAbstractListModel. It lists items from newest to oldest and that means that new items are inserted at the top.
This visually is fine, in most cases its what you want.
But there is a feature where I click on a specific item and I show some extra info in a popup. In that case it becomes very confusing when the underlying list-item it is for, moves. Due to a new item being inserted at the top of the list and moving all items down.
So my question is; how do I avoid the list item moving on screen while my popup is open?
I've tried to do a currentItem.mapToGlobal() and then adjust the contentY of the listview, which seems to not work very well as it feels like I'm fighting some listview stuff doing the same but in opposite direction.
As a note, I remove all transitions but that didn't seem to help.The only thing I've got left is to somehow avoid the model updating while the popup is open, but that sounds very dirty and it would be nice to avoid more code in the model just to support the view.
Does anyone have any ideas on how to keep the clicked listview item stable on screen while items are inserted above it?
-
I have a ListView which is backed by a QAbstractListModel. It lists items from newest to oldest and that means that new items are inserted at the top.
This visually is fine, in most cases its what you want.
But there is a feature where I click on a specific item and I show some extra info in a popup. In that case it becomes very confusing when the underlying list-item it is for, moves. Due to a new item being inserted at the top of the list and moving all items down.
So my question is; how do I avoid the list item moving on screen while my popup is open?
I've tried to do a currentItem.mapToGlobal() and then adjust the contentY of the listview, which seems to not work very well as it feels like I'm fighting some listview stuff doing the same but in opposite direction.
As a note, I remove all transitions but that didn't seem to help.The only thing I've got left is to somehow avoid the model updating while the popup is open, but that sounds very dirty and it would be nice to avoid more code in the model just to support the view.
Does anyone have any ideas on how to keep the clicked listview item stable on screen while items are inserted above it?
@TomZ I'm not sure, but one thing that occurs to me is that if the model is updating while the popup is open, is it possible to get into a state where the item in question is pushed off the bottom of the visible items? That would perhaps suggest that disabling updates is a reasonable approach.
-