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?
First create your g (or g2d) drawstring object String string = "Hello World"; then create a Font object Font stringFont = new Font( "SansSerif", Font. PLAIN, 18 ); Next set the Font object to the g or g2d object g2d. setFont( stringFont ); Now apply the g2d (or g) object to your drawstring object g2d.
Open the Accessibility settings by pressing the Windows key + U. Look under Vision and click Text size. Adjust the Text size slider until the sample text in the Text size preview is easy to read. Click Apply.
Object. setFont(new Font("Font-Style", Font-Weight, Font Size)); We use the same code as above keeping font styles the same while changing only the font size. We create a JLabel object (obj1) and assign a font size of 16 and another JLabel object (obj2) with a font size of 30.
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(....);
Figured it out:
QFont font;
font.setPixelSize(12);
for(int i = 0; i < 10; i++){
painter->drawLine(100, 100 + i * 800/9, 900, 100 + i * 800/9);
str = QString::number((double)9 - i, 'd', 1);
painter->setFont(font);
painter->drawText(75, 100 + i * 800/9 - 6, 40, 40, 1, str);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With