Кривая печать таблицы в QWebView



  • Есть примерно такой код

       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.setPaperSize(QPrinter::A4);
        printer.setOrientation(QPrinter::Portrait);
    
        QPrintPreviewDialog * prevDlg = new QPrintPreviewDialog(&printer);
        QObject::connect(prevDlg, SIGNAL(paintRequested(QPrinter*)), lWebView, SLOT(print(QPrinter*)));
    
        prevDlg->exec();
    

    В предпросмотре таблица отображается нормально, но если распечатать эту страницу, то таблица плывет. Использую mingw, Qt5.4.1

    P.S. В Qt5.3.0 такой проблемы нет.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.