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

QML Strict mode fails to compile inline object for Qt.font call

    XMLWordPrintable

Details

    Description

      This:

      pragma Strict
      import QtQuick
      import QtQuick.Controls
      Window {
          id: window
          width: 640
          height: 480
          visible: true
          readonly property font fnt: Qt.font({
                                                     "family": "Arial",
                                                     "weight": Font.Normal,
                                                     "italic": false,
                                                     "pixelSize": 32
                                                 })
      }
      

      Fails with:

      FAILED: .rcc/qmlcache/quickcmake_Main_qml.cpp /home/user/work/tests/build-quickcmake-Desktop_Qt_6_7_0_64-Debug/.rcc/qmlcache/quickcmake_Main_qml.cpp 
      cd /home/user/work/tests/build-quickcmake-Desktop_Qt_6_7_0_64-Debug && /usr/bin/cmake -E make_directory /home/user/work/tests/build-quickcmake-Desktop_Qt_6_7_0_64-Debug/.rcc/qmlcache && /home/user/Qt/6.7.0/gcc_64/./libexec/qmlcachegen --bare --resource-path /QtBug/Main.qml -I /home/user/work/tests/build-quickcmake-Desktop_Qt_6_7_0_64-Debug -I /home/user/Qt/6.7.0/gcc_64/./qml -i /home/user/work/tests/build-quickcmake-Desktop_Qt_6_7_0_64-Debug/QtBug/qmldir --resource /home/user/work/tests/build-quickcmake-Desktop_Qt_6_7_0_64-Debug/.rcc/qmake_QtBug.qrc --resource /home/user/work/tests/build-quickcmake-Desktop_Qt_6_7_0_64-Debug/.rcc/quickcmake_raw_qml_0.qrc --resource /home/user/work/tests/build-quickcmake-Desktop_Qt_6_7_0_64-Debug/.rcc/quickcmake_translations.qrc -o /home/user/work/tests/build-quickcmake-Desktop_Qt_6_7_0_64-Debug/.rcc/qmlcache/quickcmake_Main_qml.cpp /home/user/work/tests/quickcmake/Main.qml
      Main.qml:14: (strict mode) QJSValue has no property called family
      Aborted (core dumped)
      

      However, if the javascript object that is passed to font() is constructed as a property of its own, this does not happen.

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            poikelin Joni Poikelin
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes