Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-66430

QML font size changes after calling QApplication::font()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.11.0 Beta 2
    • 5.10.0
    • Quick: Controls 2
    • None
    • Ubuntu 16.04 Xenial
    • 01b0e2316771b495e3ef3586585f2bc626557394

    Description

      Size of a font in the QML application depends on the call to QApplication::font() function. In case of Ubuntu it's smaller after calling it. I'm pretty sure it wasn't the case in Qt 5.7 that I was using previously.

      Here is a small application reproducing the issue. Also, screenshot with a result of calling with and without 'small' parameter is attached.

       

      #include <QApplication>
      #include <QFont>
      #include <QQmlApplicationEngine>
      #include <QQmlContext>
      
      int main(int argc, char** argv) {
        QApplication app(argc, argv);
      
        QString app_name = "big";
      
        if (argc > 1 && app.arguments().at(1) == "small") {
          auto font = app.font();
          app_name  = "small";
        }
      
        QQmlApplicationEngine engine;
        engine.rootContext()->setContextProperty("app_name", app_name);
        engine.loadData(R"(
      import QtQuick 2.10
      import QtQuick.Controls 2.3
      
      ApplicationWindow {
        title: app_name
        visible: true
      
        Text {
          text: "<b>Some text</b>"
        }
      }
      )");
      
        return app.exec();
      }
      

      Attachments

        1. font_test.png
          12 kB
          Jakub Kotur
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            qba Jakub Kotur
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes