Quantcast
Channel: Qt DevNet forums: Qt WebKit
Viewing all articles
Browse latest Browse all 542

QWebView not respecting html

$
0
0
QWebView does not seem to respect <thead> code for tables. Other attributes including CSS that I have tried seem to be working fine. Here’s what I’m doing: Create simple html code for a long table. Html code for table headers are enclosed in <thead></thead> so that they would be repeated when table spans more than one page. Assign the html code to a QWebView Print the QWebView to pdf using QPrinter What I expect is for the headers to be repeated when the table spans more than 1 page. But that’s not the case. If I assign the same code to a QTextBrowser, it works fine: the headers are repeated in new pages. But I’d like to use a QWebView since it supports CSS better. Only other post related to this I found was this [qtforum.de] dating back to 2008 (no responses) as well as this bug [bugreports.qt.io] that appears to affect version 5. Any suggestions/guidance/comments would be greatly appreciated. Thanks. Some additional info: Using Qt 4.8.2 Tried on Linux (Fedora) and Windows 7 (compiled with VS2010) Removed full code below to bypass the “spam” detection Edit: I’m including the full code and the images of the resulting pdfs posted in comments for future refereces: full code: http://pastebin.com/e4bmEyV7 webViewOutput.pdf: http://i.imgur.com/i47qrdo.png textBrowserOutput.pdf: http://i.imgur.com/XxoC61b.png   // --------------------------------------------------   // QWebView approach:   QWebView webView;   webView.setHtml( generateHtmlTable(100) );     printer.setOutputFileName("webViewOutput.pdf");   webView.print(&printer);   // --------------------------------------------------       // --------------------------------------------------   // QTextBrowser approach:   QTextBrowser textBrowser;   textBrowser.setHtml( generateHtmlTable(100) );     printer.setOutputFileName("textBrowserOutput.pdf");   textBrowser.print(&printer);   // --------------------------------------------------

Viewing all articles
Browse latest Browse all 542

Trending Articles