Qt World Summit: Register Today!

ListView select newly added item

  • I'm having issues selecting the most recently added item but am experiencing some issues. I expected that I'd be able to simply set the ListView's currentIndex property in the onAdd attached handler but that doesn't appear to be working. Interestingly, if I add an item AFTER the currently selected item, everything works fine and the new item becomes the currentIndex item. However if the new item is inserted BEFORE the currently selected item, the onAdd handler gets called and the currentIndex property gets set (I can see this happening via the onCurrentIndexChanged handler as well) but something else is coming through and setting the currentIndex property back to what it was before. I can't figure out why this is changing or even how to figure out what is changing the currentIndex property. Any ideas or debugging suggestions would be greatly appreciated!

Log in to reply