Доброго времени суток. Есть задача вывести таблицу, формируемую динамически на принтер, с предварительным просмотром.
QTextStream lTextStream;
QString lString;
lTextStream.setString(&lString, QIODevice::ReadWrite);
lTextStream << "<!DOCTYPE html> ";
lTextStream << "<html>" ;
lTextStream << "<head>";
lTextStream << "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />";
lTextStream << "<title>Name</title>";
lTextStream << "</head>";
lTextStream << "<body>";
lTextStream << "<table width='500' border='1'>";
lTextStream << "<caption>";
lTextStream << "Tovary";
lTextStream << "</caption>";
lTextStream << "<tr>";
lTextStream << "<th>Tovar</th>";
lTextStream << "<th>Kolichestvo</th>";
lTextStream << "<th>cena</th>";
lTextStream << "</tr>";
lTextStream << "<tr>";
lTextStream << "<td>Samsung</td>";
lTextStream << "<td align='center'>1</td>";
lTextStream << "<td align='right'> 500</td>";
lTextStream << "</tr>";
lTextStream << "<tr>";
lTextStream << "<td>LG</td>";
lTextStream << "<td align='center'>2</td>";
lTextStream << "<td align='right'>1000</td>";
lTextStream << "</tr>";
lTextStream << "</table>";
lTextStream << "</body>";
lTextStream << "</html>";
QWebView * lWebView = new QWebView();
lWebView->setHtml(lString.toUtf8());
QPrinter printer;
// printer.setResolution(QPrinter::ScreenResolution);
printer.setPaperSize(QPrinter::A4);
printer.setOrientation(QPrinter::Portrait);
QPrintPreviewDialog * prevDlg = new QPrintPreviewDialog(&printer);
QObject::connect(prevDlg, SIGNAL(paintRequested(QPrinter*)), lWebView, SLOT(print(QPrinter*)));
prevDlg->exec();
в браузере не чего не плывет, помогите пожалуйста разобраться! За ранее благодарю!