QPrinter print in Qt with QPainter



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.