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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.10.0
    • Fix Version/s: 5.11.0 Beta 2
    • Component/s: Quick: Controls 2
    • Labels:
      None
    • Environment:
      Ubuntu 16.04 Xenial
    • Commits:
      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

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            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