Difference between revisions of "Development/Tutorials/Necessitas/Assets"

Jump to: navigation, search
(Deploy assets)
(Android assets)
Line 1: Line 1:
 
==Android assets==
 
==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.
+
  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 ===
 
=== Deploy assets ===
 +
Before accessing an asset we need to deploy it.
 
<syntaxhighlight lang="make">
 
<syntaxhighlight lang="make">
 
# assuming you want to deploy qml/foo/main.qml file, you need to add the flowing lines to your .pro/.pri file(s)
 
# assuming you want to deploy qml/foo/main.qml file, you need to add the flowing lines to your .pro/.pri file(s)
Line 15: Line 16:
  
 
=== Access assets ===
 
=== Access assets ===
 +
 
<syntaxhighlight lang="cpp-qt">
 
<syntaxhighlight lang="cpp-qt">
  

Revision as of 11:59, 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

Before accessing an asset we need to deploy it.

# assuming you want to deploy qml/foo/main.qml file, you need to add the flowing lines to your .pro/.pri file(s)
delployment.files=qml/foo/main.qml
android { #define an android block
    delployment.path=/assets #all assets must go to "/assets" folder of your android package
} else : maemo5 { #other platforms
    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

Content is available under Creative Commons License SA 4.0 unless otherwise noted.