harakiri
22nd June 2007, 14:17
hi,
i've got a problem with a Qstring i want to print. the string is very long an contains a table made with <tr>, <th>, <br> and so on.
Printing it with the following configuration leads to a result, in which only one line exists and ends at the end of the page. The tags like <br> are idnored -simply printed-, too.
void THIS::printQString() {
Q_ASSERT(xLabel->text());
QPrintDialog dialog(&printer, this);
if (dialog.exec()) {
QPainter painter(&printer);
QFont font("Courier", 8 );
painter.setPen( Qt::black );
painter.setFont(font);
painter.drawText(10, 10,xLabel->text());
}
}
xLabel->setText(COMPLEXTEXT); does exactely what i want but painter.drawText(10, 10,xLabel->text()); doesn't format the QString in the same way. I want the printing result look exactely the same way as the QLabel xLabel (it fits on a page for sure).
How can this be done?
i've got a problem with a Qstring i want to print. the string is very long an contains a table made with <tr>, <th>, <br> and so on.
Printing it with the following configuration leads to a result, in which only one line exists and ends at the end of the page. The tags like <br> are idnored -simply printed-, too.
void THIS::printQString() {
Q_ASSERT(xLabel->text());
QPrintDialog dialog(&printer, this);
if (dialog.exec()) {
QPainter painter(&printer);
QFont font("Courier", 8 );
painter.setPen( Qt::black );
painter.setFont(font);
painter.drawText(10, 10,xLabel->text());
}
}
xLabel->setText(COMPLEXTEXT); does exactely what i want but painter.drawText(10, 10,xLabel->text()); doesn't format the QString in the same way. I want the printing result look exactely the same way as the QLabel xLabel (it fits on a page for sure).
How can this be done?