Use onItemClicked signal to check if changes need to be saved