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

qmlsc: Support DefineObjectLiteral

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • P3: Somewhat important
    • 6.x
    • 6.4.0
    • QML: Compiler
    • All

    Description

      import QtQuick
      import QtQuick.Controls.Material
      
      ApplicationWindow {
          id: window
          width: 640
          height: 480
          visible: true
          title: qsTr("Test")
      
          function onRequestDialog() {
              var dummy = "10";
              var cmp = Qt.createComponent("qrc:/main.qml");
              var dlg = cmp.createObject(window, {"helper": dummy});
          }
      }
      

      returns this error:

      Error: main.qml:29:36: Could not compile function onRequestDialog: Cannot generate efficient code for DefineObjectLiteral
              var dlg = cmp.createObject(window, {"helper": dummy});
                                         ^^^^^^
      

      In other cases I get this error:

      Error: MWAppMainPage.qml:23:33: Could not compile function onRequestDialog: Instruction "generate_StoreLocal" not implemented
                      dlg = component.createObject(appMainPage, {"helper": dialog});
                                      ^^^^^^^^^^^^
      

      using this Qml (excerpt):

      Page {
          id: appMainPage
          function onRequestDialog(dialog : AbstractDialog) {
                      var component, dlg;
                      if (dialog.modal || !dialog.cancelable) {
                          component = Qt.createComponent("qrc:/imports/test/dialogs/MWAbstractDialog.qml");
                          dlg = component.createObject(appMainPage, {"helper": dialog});
                      }
          }
      }
      

      Attachments

        Activity

          People

            qtqmlteam Qt Qml Team User
            Harald Meyer Harald Meyer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: