Details
-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
4.8.5
-
None
-
linux (debian, ubuntu, fedora), libqtwebkit4 2.3.2, qt: 4.8.5
Description
Setting the default font size of QWebView via QWebSettings results in a smaller font size as compared to specifying the size explicitly in a html string.
Not sure, if thats a bug or a misconception on my part. Shouldn't the following two code examples render the same font size?
A) font size via qwebsettings:
#include <QtGui> #include <QWebView> int main(int argc, char** argv) { QApplication app(argc, argv); QWebView* view = new QWebView; QWebSettings* websettings = QWebSettings::globalSettings(); websettings->setFontSize(QWebSettings::DefaultFontSize, 10); websettings->setFontFamily(QWebSettings::StandardFont, "Droid Sans"); view->setHtml("<html><body>Hello, just some text.</body></html>"); view->show(); return app.exec(); }
B) font size set in html string:
#include <QtGui> #include <QWebView> int main(int argc, char** argv) { QApplication app(argc, argv); QWebView* view = new QWebView; view->setHtml("<html><body style='font-size:10pt; font-family:\"Droid Sans\"'>Hello, just some text.</body></html>"); view->show(); return app.exec(); }
Independently of the font I use, the font size I get, if set by QWebSettings, is always 3pt smaller than in B) or other qt widgets like menu bars.