I am using QWebView
to display html pages. I am using Twitter bootstrap 3.2 as the UI framework. I find that pages are displayed differently when viewed in FF and Chrome, than when rendered by QWebView
in my application. Both FF and Chrome render the html pages fairly similarly, however in QWebView
, even the fonts used etc are different.
This leads me to think that QWebView
is applying its own defaults to the loaded html document.
Here is how QWebView
is being instansiated in my application:
m_viewer = new QWebView();
//Disable Reload RH mouse click on browser view
m_viewer->page()->action(QWebPage::Reload)->setVisible(false);
// set blank sheet (to prevent flicker when startup screen is shown)
m_viewer->setHtml("<html><body></body></html>");
setCentralWidget(m_viewer);
I use setHtml()
to load a new page.
Here is sample HTML I use to test the required functionality
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="refresh" content="5; url=login.html" >
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Dummy Demo</title>
<style type="text/css">
body { -webkit-user-select: none; }
</style>
<link href="bootstrap-3.2.0-dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body ondragstart="return false">
<div class="container">
<div class="hero-unit">
<h1>Well, do you feel lucky Punk?!</h1>
<p>Lorem ipsum etc cetera ...</p>
</div>
<hr />
<div class="footer">
<div class="span4">© Me, myself & I 2014</div>
<div class="span4"></div>
<div class="span4"></div>
</div>
</div>
<script src="js/jquery-1.8.2.min.js"></script>
<script src="bootstrap-3.2.0-dist/js/bootstrap.min.js"></script>
</body>
</html>
I have two questions:
Is there something like Firebug that I could use to inspect the loaded document in
QWebView
?. Failing that, how do I confirm that stylesheets and JavaScript referenced in the loaded document have been loaded successfully?Is there a way to switch off ALL styling defaults in
QWebView
?