Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Android system images in QML

    QML and Qt Quick
    2
    2
    843
    Loading More Posts
    • 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.
    • C
      charango last edited by

      Is there any way to use system Android resources (images) in QML code?
      Like images I see in %ANDROID_SDK_DIR%\platforms\android-xx\data\res\drawable-yyyy?

      @import QtQuick 2.3
      import QtQuick.Controls 1.2

      ApplicationWindow {
      title: qsTr("Hello World")
      width: Screen.width
      height: Screen.height
      visible: true

      Image {
      source: "file://android/image/drawable/ic_menu_more" // don't work
      }
      }
      @

      1 Reply Last reply Reply Quote 0
      • Gianluca
        Gianluca last edited by

        It seems that not all drawable can be used by Android native app.
        From this discussion: http://stackoverflow.com/questions/4673629/how-can-i-access-all-drawables-in-android
        the best approach is to copy the image into your app bundle (even in the case of Android native app).
        So, copy it as a Qt resource and reference it as: "qrc://... "

        1 Reply Last reply Reply Quote 0
        • First post
          Last post