QCustomPlot Discussion and Comments

Feature request: add access functions to QCPColorScale's QCPColorScaleAxisRectPrivateReturn to overview

I'd like to request adding modification functions to QCPColorScaleAxisRectPrivate of QCPColorScale, to allow modifications of the axis properties.
For example, in the current version the axisRect being drawn has no QPen or a pen with no color. Hence, the drawn colorscale does not have outer boundary lines. Also, showing the grid is not possible without modifying the source code.

I have solved this for now by deriving my own myColorScale from QCPColorScale to add modification functions, and by adding a getter to the QCPColorScale source code in line 5067 in qcustomplot.h:

auto getAxisRect() { return &mAxisRect;}

For future maintainability, it would be great if one could change these properties (such as line color, grid, etc.) without modifying the QCP sources.

It should work already with colorScale->axis()->axisRect(), right? No need to modify code. I guess the "border" of the axis rect is just the base pen (axis->setBasePen()) of all the axes, left, right, top, bottom, which you can access through the axisRect()->axes().
so try something like

foreach (QCPAxis *axis, colorScale->axis()->axisRect()->axes())

What is strange though is that you say your color scale has no border line. In my case (and also in the documentation: https://www.qcustomplot.com/documentation/classQCPColorScale.html#details), the color scale has a black border as expected with normal axes.

Oh, you're right it does work with colorScale->axis()->axisRect()! I wasn't aware of that.
No idea why the border does not show up, I only have the (vertical in my case) colorScale->axis().
Anyway, thanks a lot for the help!