Uploaded image for project: 'Qt Design Studio'
  1. Qt Design Studio
  2. QDS-10766

Singleton QML components are mistaken as properties

    XMLWordPrintable

Details

    • All

    Description

      I'm using QDS 4.2.

      I attached the project to show the issue. (CoffeMaker.zip)

      The issue is happening in BrewingProgress.qml, where the singleton "BrewTimer" is used twice at the line 64 and line 67. They are said to be Invaild properties.

      When I do a Live Preview, it doesn't work because of the error above. Here is the Application Output.

       

      22:09:45: Starting C:\Qt\Tools\QtDesignStudio\qt6_design_studio_reduced_version\bin\qml2puppet-4.2.0.exe --qml-runtime -I C:/work/MCU_Training_Material/CoffeMaker/imports -I C:/work/MCU_Training_Material/CoffeMaker/imports/CoffeeControls C:/work/MCU_Training_Material/CoffeMaker/BrewingProgress.qml "-qmljsdebugger=file:C:/Users/81808/AppData/Local/Temp/QtDesignStudio-IGHDXg/qtc-socket.VJUoqd,block,services:QmlPreview,DebugTranslation"...
      QML debugging is enabled. Only use this in a safe environment.
      Info: Starting QML Runtime ((null):0, (null))
      Warning: CoreApp is not initialized! Falling back to QGuiApplication! ((null):0, (null))
      Debug: QML Debugger: Connecting to socket C:/Users/81808/AppData/Local/Temp/QtDesignStudio-IGHDXg/qtc-socket.VJUoqd... ((null):0, (null))
      Warning: QQmlApplicationEngine failed to load component ((null):0, (null))
      Warning: file:///C:/work/MCU_Training_Material/CoffeMaker/BrewingProgress.qml:64:5: Non-existent attached object (file:///C:/work/MCU_Training_Material/CoffeMaker/BrewingProgress.qml:64, (null))
      Critical: QEventDispatcherWin32::wakeUp: Failed to post a message (ウィンドウ ハンドルが無効です。) ((null):0, (null))
      qml: Did not load any objects, exiting.
      22:09:47: C:\Qt\Tools\QtDesignStudio\qt6_design_studio_reduced_version\bin\qml2puppet-4.2.0.exe exited with code 2
        

       

       

      BrewTimer is part of the module BackEnd, which is located under imports directory.
      Here is what's inside BrewTimer.qml.

      pragma Singleton
      import QtQuick
      
      Timer {
          id: root    
          signal brewFinished()
          signal brewProgressStep()
          function startBrew(strength: number, capacity: number, temperature: number) {
              m_brewTimer.setInterval(calculateProgressInterval(strength, capacity, temperature))
              m_brewTimer.start()
          }    
          property int m_tickcount
          readonly property int _BREW_PROGRESS_TICKCOUNT: 150
          readonly property int _DEFAULT_BREW_PROGRESS_INTERVAL: 20
          readonly property int _DEFAULT_PARAM_SUM: 4
          readonly property int _PARAM_MULTIPLIER: 3
          function calculateProgressInterval(strength: number, capacity: number, temperature: number) {
              let sumOfParams = strength + capacity + temperature;
              if (sumOfParams == _DEFAULT_PARAM_SUM) {
                  return _DEFAULT_BREW_PROGRESS_INTERVAL;
              } else if (sumOfParams < _DEFAULT_PARAM_SUM && sumOfParams > 0) {
                  return _DEFAULT_BREW_PROGRESS_INTERVAL - ((_DEFAULT_PARAM_SUM - sumOfParams) * _PARAM_MULTIPLIER);
              } else if (sumOfParams > _DEFAULT_PARAM_SUM) {
                  return _DEFAULT_BREW_PROGRESS_INTERVAL + ((sumOfParams - _DEFAULT_PARAM_SUM) * _PARAM_MULTIPLIER);
              } else {
                  return _DEFAULT_BREW_PROGRESS_INTERVAL - (_DEFAULT_PARAM_SUM * _PARAM_MULTIPLIER);
              }
          }    
      
          onTriggered: {
              if (m_tickCount < _BREW_PROGRESS_TICKCOUNT) {
                  brewProgressStep();
                  m_tickCount++;
              } else {
                  stop();
                  brewingFinished();
                  m_tickCount = 0;
              }
          }
      }
       

      and here is qmldir.

      module Backend
      singleton BrewTimer 1.0 BrewTimer.qml
      CoffeeModel 1.0 CoffeeModel.qml
      singleton TimeStamp 1.0 TimeStamp.qml
       

      Although QDS fails to recognize the Singleton QML type which is used in a way BrewTimer was, it does recognize if the Singleton QML type's property is assigned to another property, like so.

      import QtQuick
      import Constants
      Item {
          width: Constants.width    // <-- Constants is Singleton
          height: Constants.height  // <-- Constants is Singleton
      } 

       

       

       

      Attachments

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

        Activity

          People

            tokorpip Tomi Korpipää
            mikio_hirai Mikio Hirai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes