Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Qwebsettings font size issue
Forum Updated to NodeBB v4.3 + New Features

Qwebsettings font size issue

Scheduled Pinned Locked Moved Qt WebKit
1 Posts 1 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    b3nmore
    wrote on last edited by
    #1

    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\"'

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved