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

LocalStorage not working with qtquickcompiler

    XMLWordPrintable

Details

    • 0a2aaee61cfc2888bc71f54ac5b165d248cbf5e8

    Description

      When running application compiled with CONFIG+=qtquickcompiler option, LocalStorage inited in Database.js file does not inited. Console error: 

      ../Test4/Database.js:7: ReferenceError: Sql is not defined

      Database.js file is:

      .pragma library
      .import QtQuick.LocalStorage 2.0 as Sql
      
      var db = null
      
      function connectToDB() {
          db = Sql.LocalStorage.openDatabaseSync("Test4", "1.0",
                                                 "Local test Data", 1000000)
          if (db) {
              db.transaction(function (tx) {
                  tx.executeSql(
                              'CREATE TABLE IF NOT EXISTS Table1(id NUMBER, str TEXT)')
              })
          }
      }
      

      Without qtquickcompiler all works as expected.

      To reproduce error run test project "Test4" from attachment.

      Attachments

        Activity

          People

            shausman Simon Hausmann
            alexxey593 Stolyarov Aleksey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: