Avoid reordering the legend after every removed element in QCPLegend::clearItems.
Reordering requires removing every element (storing it in a temporary array), simplifying the layout, and then adding each back in finding the right place. This is not needed when clearing the whole legend, and adds a lot of complexity.