QML extension

 


 

For QML extension (inherits from QQmlExtension) , you have to place the custom QML extension into the qml folder in Qt installed directory (ex: /Users/diro/Qt5.3.0/5.3/android_armv7/qml).

Take the extension DiroComponent for example, then you should have a directory named /Users/diro/Qt5.3.0/5.3/android_armv7/qml/DiroComponent , and the libDiroComponent.so & qmldir should be put in the directory, too. Finally, the androiddeployqt tool will pack this custom QML extension into the APK file for deploying. 

For the underlying detail, the androiddeployqt will rename the .so file into libqml_DiroComponent_libDiroComponentExtension.so, and copy it into build_dir/android-build/libs/armeabi-v7a (Actually, all the native .so shared library are placed here)

Now you can enjoy your QML without any modification.

 


 

QML extension (inherits from QQmlExtension) 的作法比較特別,你必需把你的 QML extension 乖乖的放到 qt 安裝目錄中的 qml 資料夾(ex: /Users/diro/Qt5.3.0/5.3/android_armv7/qml)。例如你有個 extension 叫做 DiroComponent,那麼你就會有個
/Users/diro/Qt5.3.0/5.3/android_armv7/qml/DiroComponent 資料夾,並在裡頭放著你的 .so & qmldir,這樣子 androiddeployqt 就會把你的 QML extension 打包進 APK 中。

打包的細節部份,他會 rename 你的 .so,變成 libqml_DiroComponent_libDiroComponentExtension.so ,並放進 build_dir/android-build/libs/armeabi-v7a 裡頭(其實所有的 .so 都會被放在這,包含 implicit&explicit link 的 shared library)

這樣子你就可以在你的 QML 中快樂的使用這些 extension ,不需要做任何更改。

創作者介紹
創作者 diro 的頭像
diro

Diro - 探索生活中的美好事物

diro 發表在 痞客邦 留言(0) 人氣()