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

qwebsettings font size issue

$
0
0
Hi, I’m having some troubles with font sizes rendered by qwebview. Shouldn’t the following two examples show the same font size? a) Set 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) set font size in html string [1]: #include <QtGui> #include <QWebView>   int main(int argc, char** argv) {     QApplication app(argc, argv);     QWebView* view = new QWebView;     view->setHtml("<html><body >Hello, just some text.</body></html>");   view->show();     return app.exec(); } For me all font sizes set via qwebsettings are 3pt too small as compared to case b) or to other qt widgets like menu bars. [1] Oh crap, the forum software filters out my html string in example b). The <body> tag should be: body style=‘font-size:10pt; font-family:\\“Droid Sans\\”’

Viewing all articles
Browse latest Browse all 542

Trending Articles