Qt 6.11 is out! See what's new in the release
blog
QPrinter print in Qt with QPainter
General and Desktop
1
Posts
1
Posters
1.5k
Views
1
Watching
-
Hello Forum,
my next Project is printing. I have a code than i print four words on the left/top site.
@ QString printText = "Test Text zum Drucken";
QPrinter printer; QPrintDialog *dialog = new QPrintDialog(&printer); dialog->setWindowTitle("Print Document"); if(dialog->exec() != QDialog::Accepted) QMessageBox::critical(this,"Error","Fehler beim öffnen des Druckers"); QPainter painter; painter.begin(&printer); painter.drawText(100,100,500,500,Qt::AlignLeft|Qt::AlignTop, printText); painter.end();@When the text is longer i can´t print correct on a A4 site. What is wrong with this code.
Must need a another code or other parameters?Alex from Germany