I have a Legend positioned to the right of the graph in it's own column.


However a problem occurs when the user tries to plot more lines than the Legend can contain in it's height (Legend items either get squashed together and become unreadable or fall off outside the viewport depending on the sublayout I use)


Ideally I'd like to cull the elements in Legend so that only the top N elements are contained within the legend and the rest are shown as simply "and 5 more plots..." as a label at the bottom of the Legend. The only height metrics that seem to be available to me before the layout are the QCustomPlot height which doesn't accurately represent the layout row size (There are cases where a new row in inserted below, shrinking the row size and my calculated metrics are all wrong)

I've attempted to force a layout and fetch the layout outerRect but this gives me a garbage height value of 480px no matter what.

Any suggestions on how I can correctly measure the available legend size?