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

Use Singleton object from other Singleton object within the same package will hang

    XMLWordPrintable

Details

    Description

      Assume there has 3 singleton objects within a same package. They are A, B and C. Object B depends on Object A. Since Qt can not resolve singleton object within same package automatically. It need to add `import "."` statement in B.qml to make it works.

      B.qml

      import QtQuick 2.0
      pragma Singleton
      import "."
      
      Item {
      /// Use A
      }
      

      However, if C also depends on A. Then the QML application will just hang on startup.

      I have attached an example code to prove it. The program should launch a window, but in fact it won't. It will just hang.

      If you remove the `import "."` statement from either of B.qml / C.qml. Then it will work again. The bug happen if there has more than one `import "."` statement from singleton component within the package.

      p.s Any workarounds for this problem?

      Attachments

        Issue Links

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

          Activity

            People

              qtqmlteam Qt Qml Team User
              benlau Ben Lau
              Votes:
              13 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes