Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QtQuick.LocalStorage dont work properly with qmlscene from Qt Designer Studio

QtQuick.LocalStorage dont work properly with qmlscene from Qt Designer Studio

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 441 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    leoleo
    wrote on last edited by
    #1

    When I run Qmlscene preview from Qt Designer Studio trial , for standart example project (Clock ) which using QtQuick.LocalStorage it dont work. Log showing Error: LocalStorage: can't create path C:\Users\leo\AppData\Local\QtProject\QtQmlViewer\QML\OfflineStorage\Databases from LocalStorage.openDatabaseSync(...) function.

    Explored Qt sources i found source of localstorage plugin where was this part

    QString basename = args->v4engine()->qmlEngine()->offlineStorageDatabaseFilePath(dbname);
    QFileInfo dbFile(basename);
    if (!QDir().mkpath(dbFile.dir().absolutePath())) {
    const QString message = QQmlEngine::tr("LocalStorage: can't create path %1").arg(QDir::toNativeSeparators(dbFile.dir().absolutePath()));
    V4THROW_SQL2(SQLEXCEPTION_DATABASE_ERR, message);
    }
    QString dbid = dbFile.fileName();
    bool created = false;
    QString version = dbversion;
    QSqlDatabase database;
    

    So I think there is some problem to open/create database file on default path for qt projects by qmlscene. I cant change default path and cant set offlineStorage(path) becouse i have not access to C++ code (its .qmlproject). When I run project (not using menu item "QML Preview") or build it with C++ qmlengine loader its working normal with localstorage, but when i try to preview via QML scene tool from Qt Design Studio its show error.

    Have somebody ideas how fix it or other way to use localstorage in QMLscene tool ?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leoleo
      wrote on last edited by
      #2

      Problem is bug and not decided. I found new way to store local data by write wrapers for Qt.lab.settings instantiated in Singleton qml file.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved