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

QML Settings object has no sync()

XMLWordPrintable

    • Linux/X11

      The QML Settings [documentation|https://doc.qt.io/qt-5/qml-qt-labs-settings-settings.html|https://doc.qt.io/qt-5/qml-qt-labs-settings-settings.html] lists a `sync()` method.

      However, the following code snippet 

      import QtQuick 2.12
      import QtQuick.Window 2.12
      import Qt.labs.settings 1.0
      Window {
          id: window
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World") 
          onWidthChanged: wh.sync()
          Settings {
              id: wh
              property alias w: window.width
              property alias h: window.height
              Component.onCompleted: wh.sync()
              onWChanged: sync()
          }
      }

      Results in the following errors

      qrc:/main.qml:20: ReferenceError: sync is not defined
      qrc:/main.qml:12: TypeError: Property 'sync' of object QQmlSettings_QML_0(0x2379a70) is not a function
      qrc:/main.qml:19: TypeError: Property 'sync' of object QQmlSettings_QML_0(0x2379a70) is not a function
      
      

      This code seems to run fine on 5.14.2 though the documentation has no indication that it is only available since a specific version

       

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            vdaele vdaele
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes