Use the currentIndex from the selection model to determine which item is currently active. This allows updating the current polygon both when an item in the treeview is clicked, and also when it's just selected via the keyboard.
Remove the clicked_index member, which can be replaced with the QTreeView's currentItem().
Use the currentIndex from the selection model to determine which item is currently active. This allows updating the current polygon both when an item in the treeview is clicked, and also when it's just selected via the keyboard. Remove the clicked_index member, which can be replaced with the QTreeView's currentItem().