Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-32514

QML Preview: Updates to Singletons do not reflect in the preview

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • Qt Creator 15.0.1, Qt Creator 16.0.0-beta2
    • QML Preview
    • Windows 10 22H2

    Description

      Code

      import QtQuick
      import SingletonTest
      
      Window {
          width: 640
          height: 480
          visible: true
          color: ConstantsSingleton.col
      
          ConstantsInstantiable { id: ci }
      
          Rectangle {
              width: 100
              height: 100
              anchors.centerIn: parent
              color: ci.col
          }
      }
      

       

      Steps to reproduce

      1. Load the attached project in Qt Creator
      2. Open Main.qml and select "Build" > "QML Preview"
      3. Open ConstantsInstantiable.qml and change the value of col to a different colour
      4. Open ConstantsSingleton.qml and change the value of col to a different colour

       

      Outcomes

      • Step #2: The preview window appears (Expected)
      • Step #3: In the preview window, the central square changes to your new colour (Expected)
      • Step #4: In the preview window, the window background remains the old colour (Not Expected)

       

      Other Notes
      Even though the final result is ignored, the intermediate values in ConstantsSingleton.qml do affect the preview as described in QTCREATORBUG-32409. In the middle of doing Step #4, the preview window disappears and the General Message pane shows this:

      Error loading QML Live Preview:
      qrc:/qt/qml/SingletonTest/Main.qml:9 Type ConstantsInstantiable unavailable
      qrc:/qt/qml/SingletonTest/ConstantsInstantiable.qml:-1 Type ConstantsSingleton unavailable
      qrc:/qt/qml/SingletonTest/ConstantsSingleton.qml:5 Invalid property assignment: color expected
      

      (I'm not sure why it's complaining about ConstantsInstantiable which is in a good state - ConstantsSingleton is the one that contained the invalid colour string)

      Attachments

        1. SingletonTest.zip
          2 kB
          Sze Howe Koh
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ulherman Ulf Hermann
            skoh-qt Sze Howe Koh
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes