QCustomPlot Discussion and Comments

QCPLegend items layoutReturn to overview

Hi!
I think it would be great if the QCPLegend has a property like Orientation (Vertical | Horizontal) which would determine items positioning: row- or column-wise, respectively.
Thanks for your effort!

Yes I've considered such a feature, but didn't have the time to implement it yet.

However, note that you can still do it via the normal layout system. A QCPLegend derives from QCPLayoutGrid, and the legend items are just QCPLayoutElements in that grid. So you can arrange them like you say manually by placing them at different grid positions. See the QCPLayoutGrid::addElement() method. It can also be used to move elements that are already in the grid, to other cells.

So upon adding a graph, you could rearrange the legend items in multiple columns.