QCustomPlot Discussion and Comments

Vertical center between legend icon and legend textReturn to overview

When using large fonts on legend text items, it appears that their respective icons are aligned with the top of the text.

For example:


Would it be possible to align the icon vertically centered to the text ?

As a workaround, adapting the icon size to the text size works for me.
Something like:

    // Compute icon size according to the text font size
    const QSize size = legend->iconSize();
    const double height = QFontMetricsF(legend->font()).height();
    const double ratio = height / static_cast<double>(size.height());
    legend->setIconSize(QSize(size.width() * ratio, size.height() * ratio));

Had the same issue, crep4ever's code fixed it. Thank you!

just modified src code