Development/Tutorials/Necessitas/Assets: Difference between revisions

From KDE TechBase
Line 15: Line 15:


=== Access assets ===
=== Access assets ===
<syntaxhighlight lang="cpp-qt">
#ifdef Q_OS_ANDROID
QFile file( "qml/foo/main.qml" );
#endif
// do whatever you want with file
</syntaxhighlight>

Revision as of 11:51, 30 October 2011

Android assets

Android assets are read-only arbitrary files bundled in their raw form into your package.Necessitas project provides seamless integration with android assets, meaning that you can access any asset files as you access any ordinary files.

Deploy assets

# assuming we want to deploy qml/foo/main.qml file
delployment.files=qml/foo/main.qml
android { #define an android block
    delployment.path=/assets
} else : symbian {
    delployment.path=/opt/$${TARGET}
}
INSTALLS += delployment

Access assets

#ifdef Q_OS_ANDROID
QFile file( "qml/foo/main.qml" );
#endif

// do whatever you want with file