1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| QPrinter p;
QPrintDialog pd(&p,0);
if (pd.exec()==QDialog::Accepted){
QPainter painter;
painter.begin(&p);
painter.drawLine(p.pageRect().width() / 2, 0,
p.pageRect().width()/2, p.pageRect().height());
painter.drawLine(0, p.pageRect().height() / 2,
p.pageRect().width(), p.pageRect().height() / 2);
painter.drawImage(25,25, QImage("E:\matfi\finance-build-Desktop_Qt_5_0_1_MinGW_32bit-Debug\logo"));
QFont f;
f.setPointSize(10);
f.setBold(true);
painter.setFont(f);
painter.drawText(100, 75, "facture");
painter.drawText(100,75,"a");
//p.newPage();
//painter.drawText(100, 100, "nouvelle page");
painter.end();
} |
Partager