How to change fontsize on drawText?

c++, qt

Solution

You could try something like this (haven't compiled code to see if it works!):

QFont font = painter->font() ;

/* twice the size than the current font size */
font.setPointSize(font.pointSize() * 2);

/* set the modified font to the painter */
painter->setFont(font);

/* draw text etc. */
painter.drawText(....);

Problem

``` QString str = QString::number((double)i, 'd', 1); painter->drawText(100 + i * 800/9 - 6, 910, 40, 40, 0, str ); ``` I would like to increase fontSize to 2x what is showing?

Original source