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. Including Image as a package
Forum Updated to NodeBB v4.3 + New Features

Including Image as a package

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 2 Posters 559 Views 2 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.
  • A Offline
    A Offline
    Anita
    wrote on last edited by
    #1

    Hi,
    My query was if we can include all the images used in my qml files as a separate package,
    if we can,what are the changes to be done in our qml files and is it necessary to include them in the .qrc file ?
    Will it be possible to run it in Desktop as well as in embedded environment.?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You have practically answered yourself already :-)

      Yes, to ship images in a package, it's easiest to use QRC files - then you have them bundled with executable (or you can ship an external QRC file, too).

      Yes it will work on any operating system, including embedded.

      (Z(:^

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Anita
        wrote on last edited by
        #3

        Hi @sierdzio ,
        Thank you for the answer,

        there is one more question in the same context, if I am including images as an external package, then i will have to include the images as "file:///image.png"

        Is there any disadvantage of dynamically setting the source of the image , for example,
        what is the difference between "qrc:/image.png" and "file:///image.png". Is there any disadvantage in using file:///image.png?

        sierdzioS 1 Reply Last reply
        0
        • A Anita

          Hi @sierdzio ,
          Thank you for the answer,

          there is one more question in the same context, if I am including images as an external package, then i will have to include the images as "file:///image.png"

          Is there any disadvantage of dynamically setting the source of the image , for example,
          what is the difference between "qrc:/image.png" and "file:///image.png". Is there any disadvantage in using file:///image.png?

          sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          @Anita said in Including Image as a package:

          there is one more question in the same context, if I am including images as an external package, then i will have to include the images as "file:///image.png"

          Note: not necessarily. You can dynamically load a QRC file and then you will still use the qrc:/ call.

          Is there any disadvantage of dynamically setting the source of the image , for example,
          what is the difference between "qrc:/image.png" and "file:///image.png". Is there any disadvantage in using file:///image.png?

          There is not much difference from user perspective, both approaches work. Using QRC is usually easier to implement because you don't need to worry about deploying the images (esp. hard on mobile platforms), you don't need to even check if image file exists because you know it does. But if you set it up correctly, both solutions will work great.

          One additional advantage of QRC is that you can use aliases to "overload" certain images - use single path like :/img/logo.jpg but display different file depending on which QRC file was loaded. Similar results can be achieved using file selectors, though, too.

          (Z(:^

          1 Reply Last reply
          1
          • A Offline
            A Offline
            Anita
            wrote on last edited by
            #5

            @sierdzio ,

            Thanks for the answer, This solved my query.

            1 Reply Last reply
            0

            • Login

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