Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPrinter print in Qt with QPainter
Qt 6.11 is out! See what's new in the release blog

QPrinter print in Qt with QPainter

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nickvan86
    wrote on last edited by
    #1

    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

    Qt 5.2.1 Creator 3.0.1 Windows 7 64bit

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved