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

pragma Singleton AND import of the module itself results in endless loop / browser crash

    XMLWordPrintable

Details

    • WebAssembly

    Description

      Singleton QML files are very useful to outsource colors or icons in readonly properties. Sometimes I have multiple singleton qml files which refer to each other.

      symptoms:

      endless loop, browser crash, no warnings, no error messages 

       

      How to reproduce:

      #file 1 – qmldir 

      module MyModule
      singleton Colors 1.0       Colors.qml
      singleton TypeDef 1.0      TypeDef.qml
      

       

      #file 2 – Colors.qml 

      pragma Singleton
      import QtQuick 2.5 
      
      QtObject { 
          readonly property color greyBlue: "#485058" 
          readonly property color darkBlue: "#2e3439" 
      }
      

       

      #file 3 – TypeDef.qml 

      pragma Singleton
      import QtQuick 2.5 
      import MyModule 1.0   // this construct works in desktop environments but unfortunately not with Web Assembly
      
      QtObject { 
           function getColor(input) 
           {
             if(........)         
                return Colors.greyBlue    
             else
                return Colors.darkBlue 
            }
      }
      

       

       

      how to work around: 

      The only way to get this running in browser is to remove the import of the library and redefine the  outsourced colors. So you need to hold the Colors twice which is error prone.

       

       

       

       

      Attachments

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

        Activity

          People

            sorvig Morten Sørvig
            friedemann Friedemann Metzger
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes