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. How to use QML caching?

How to use QML caching?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 3.1k Views 1 Watching
  • 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.
  • I Offline
    I Offline
    Ibrahim
    wrote on last edited by
    #1

    Hi; I have heard QML caching. I wonder, is this available on Qt Community Edition? I wrote these into .pro file:

    QT += quick
    CONFIG += c++11 qmlcache
    
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which as been marked deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += main.cpp
    
    RESOURCES += qml.qrc
    
    # Additional import path used to resolve QML modules in Qt Creator's code model
    QML_IMPORT_PATH =
    
    # Additional import path used to resolve QML modules just for Qt Quick Designer
    QML_DESIGNER_IMPORT_PATH =
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    TARGETPATH = MyCompany/Test
    QML_FILES = main.qml Page1.qml Page1Form.ui.qml qmldir
    load(qml_plugin)
    

    But I get this error:

    Project ERROR: Project has no top-level .qmake.conf file.
    Error while parsing file /home/username/QtApp/QtApp.pro. Giving up.
    Project ERROR: Must set TARGETPATH (QML import name)
    Error while parsing file /home/username/QtApp/QtApp.pro. Giving up.
    Project ERROR: Project has no top-level .qmake.conf file.
    Error while parsing file /home/username/QtApp/QtApp.pro. Giving up.
    Project ERROR: Project has no top-level .qmake.conf file.
    Error while parsing file /home/username/QtApp/QtApp.pro. Giving up.
    

    How can I use QML caching? Thanks.

    1 Reply Last reply
    0
    • jpnurmiJ Offline
      jpnurmiJ Offline
      jpnurmi
      wrote on last edited by
      #2

      You cannot load qml_plugin (nor qml_module) to an application project.

      http://doc.qt.io/qt-5/qtquick-deployment.html#limitations

      Currently this feature has some limitations:

      • Only QML and JavaScript documents that are part of a QML module can be compiled ahead of time.

      You need to split the components you want to be cached out of the main app to a separate QML plugin or module. If you create a QML plugin (QQmlExtensionPlugin), load qml_plugin. If you create a QML module without a C++ plugin (.qmldir + .qml/.js only), load qml_module.

      1 Reply Last reply
      2

      • Login

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