I'm using the activity monitor in Mac OSX (I think this is the equivalent to task manager in Windows)
Here some more Code to understand the situation better:
Constructor of my print object
printer
->setPageMargins
(5.0,
5.0,
5.0,
5.0,
QPrinter::Millimeter);
printer->setOrientation(orientation);
if (outputType == 0) {
printer
->setOutputFormat
(QPrinter::NativeFormat);
} else {
printer
->setOutputFormat
(QPrinter::PdfFormat);
}
dialog = new QPrintPreviewDialog(printer);
dialog->setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);
dialog->setWindowTitle("TurnFix - Drucken");
dialog
->setWindowIcon
(QIcon(":/icons/icon.png"));
dialog->printer()->setPaperSize(paperSize);
connect(dialog,
SIGNAL(paintRequested
(QPrinter*)),
this,
SLOT(print
(QPrinter*)));
}
Drucken::Drucken() : QObject() {
printer = new QPrinter(QPrinter::HighResolution);
printer->setPageMargins(5.0,5.0,5.0,5.0,QPrinter::Millimeter);
printer->setOrientation(orientation);
if (outputType == 0) {
printer->setOutputFormat(QPrinter::NativeFormat);
} else {
printer->setOutputFormat(QPrinter::PdfFormat);
}
dialog = new QPrintPreviewDialog(printer);
dialog->setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);
dialog->setWindowTitle("TurnFix - Drucken");
dialog->setWindowIcon(QIcon(":/icons/icon.png"));
dialog->printer()->setPaperSize(paperSize);
connect(dialog, SIGNAL(paintRequested(QPrinter*)), this, SLOT(print(QPrinter*)));
}
To copy to clipboard, switch view to plain text mode
print method
curr_printer = prt;
if (outputType == 2) curr_printer->setOutputFileName(outputFileName);
pr = curr_printer->pageRect();
painter.begin(curr_printer);
// This is painted on every page
layoutData.prepare(...);
layoutData.bindValue(0,...);
layoutData.exec();
while (layoutData.next()) {
if (!customImages.contains(layoutData.value(6).toString())) {
pm.load(layoutData.value(6).toString());
if (!pm.isNull()) {
customImages.insert(layoutData.value(6).toString(),pm.scaled(mmToPixel(layoutData.value(4).toDouble()),mmToPixel(layoutData.value(5).toDouble()),Qt::KeepAspectRatio,Qt::SmoothTransformation));
}
}
painter.drawImage(mmToPixel(layoutData.value(2).toDouble()),mmToPixel(layoutData.value(3).toDouble()),customImages.value(layoutData.value(6).toString()));
}
// End of code for every page
...
painter.end();
customImages.clear();
}
void Drucken::print(QPrinter *prt) {
curr_printer = prt;
if (outputType == 2) curr_printer->setOutputFileName(outputFileName);
pr = curr_printer->pageRect();
painter.begin(curr_printer);
// This is painted on every page
QSqlQuery layoutData;
layoutData.prepare(...);
layoutData.bindValue(0,...);
layoutData.exec();
while (layoutData.next()) {
if (!customImages.contains(layoutData.value(6).toString())) {
QImage pm;
pm.load(layoutData.value(6).toString());
if (!pm.isNull()) {
customImages.insert(layoutData.value(6).toString(),pm.scaled(mmToPixel(layoutData.value(4).toDouble()),mmToPixel(layoutData.value(5).toDouble()),Qt::KeepAspectRatio,Qt::SmoothTransformation));
}
pm.~QImage();
}
painter.drawImage(mmToPixel(layoutData.value(2).toDouble()),mmToPixel(layoutData.value(3).toDouble()),customImages.value(layoutData.value(6).toString()));
}
// End of code for every page
...
painter.end();
customImages.clear();
}
To copy to clipboard, switch view to plain text mode
Bookmarks