Solved How change FontSize at print
-
Hi!
How change FontSize at print?
It's not work:void MainWindow::PrintDocument(QString &TextForPrint) //PrintDocument { QPrinter MyPrinter; QPrintDialog *PrinterDialog = new QPrintDialog(&MyPrinter); PrinterDialog->setWindowTitle("Print"); QFont FontForPrint; FontForPrint.setPointSize(22); //PrinterDialog->setFont(FontForPrint); if (PrinterDialog->exec()) { QPainter MyPainter; MyPainter.begin(&MyPrinter); MyPainter.drawText(100, 100, 400, 400, Qt::AlignLeft|Qt::AlignTop, TextForPrint); MyPainter.setFont(FontForPrint); MyPainter.end(); } }
-
@Mikeeeeee said in How change FontSize at print:
It's not work:
Does it change the
font
? then u have to take font fromQPrinter
and then try to modify font.
Something like thisQFont font = MyPrinter.font() ;
-
Hi
You set font After you draw the text.