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. Qt Quick2
Qt 6.11 is out! See what's new in the release blog

Qt Quick2

Scheduled Pinned Locked Moved Solved QML and Qt Quick
7 Posts 3 Posters 176 Views
  • 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.
  • Z Offline
    Z Offline
    Z.Johnn
    wrote last edited by
    #1

    I am currently learning how to use the QML language to create Android applications.In the official teaching documents of Qt, there is a step for adding background images to the interface. It seems not complicated, but when the program runs on the Android emulator, no images or other contents are displayed.setup.png 屏幕截图 2026-04-27 111759.png My code is no different from the official code. I just don't understand why there is nothing on the interface.

    jsulmJ 1 Reply Last reply
    0
    • Z Z.Johnn

      I am currently learning how to use the QML language to create Android applications.In the official teaching documents of Qt, there is a step for adding background images to the interface. It seems not complicated, but when the program runs on the Android emulator, no images or other contents are displayed.setup.png 屏幕截图 2026-04-27 111759.png My code is no different from the official code. I just don't understand why there is nothing on the interface.

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote last edited by
      #2

      @Z.Johnn How exactly did you add the image? Did you put it into a resource file?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Z 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Z.Johnn How exactly did you add the image? Did you put it into a resource file?

        Z Offline
        Z Offline
        Z.Johnn
        wrote last edited by
        #3

        @jsulm I tried again by placing the image in the qrc file, but the result was still the same.屏幕截图 2026-04-27 142657.png 屏幕截图 2026-04-27 142722.png
        屏幕截图 2026-04-27 143001.png
        There must be something wrong, but I'm not sure exactly what.

        jsulmJ 1 Reply Last reply
        0
        • Z Z.Johnn

          @jsulm I tried again by placing the image in the qrc file, but the result was still the same.屏幕截图 2026-04-27 142657.png 屏幕截图 2026-04-27 142722.png
          屏幕截图 2026-04-27 143001.png
          There must be something wrong, but I'm not sure exactly what.

          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote last edited by
          #4

          @Z.Johnn Could be that the jpeg image plug-in is not deployd as part of your app

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          Z 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Z.Johnn Could be that the jpeg image plug-in is not deployd as part of your app

            Z Offline
            Z Offline
            Z.Johnn
            wrote last edited by
            #5

            @jsulm I saw in the compilation output that the jpeg plugin has been packaged.屏幕截图 2026-04-27 162135.png
            So I attempted to check in main.cpp whether this jpg file exists, and then I found that it always returned as non-existent during runtime.
            屏幕截图 2026-04-27 163919.png
            I suspect there might be an error in my configuration, but my CMakeLists.txt file seems to be fine.屏幕截图 2026-04-27 163853.png

            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote last edited by
              #6

              Please take a look at the documentation of qt_add_qml_module. There you can see under which resource path the image is located.
              https://doc.qt.io/qt-6/qt-add-qml-module.html#resource-prefix

              Also please don't post pictures but actual text.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              Z 1 Reply Last reply
              1
              • Christian EhrlicherC Christian Ehrlicher

                Please take a look at the documentation of qt_add_qml_module. There you can see under which resource path the image is located.
                https://doc.qt.io/qt-6/qt-add-qml-module.html#resource-prefix

                Also please don't post pictures but actual text.

                Z Offline
                Z Offline
                Z.Johnn
                wrote last edited by
                #7

                @Christian-Ehrlicher Thank you all for your support and assistance. Eventually, I discovered the solution. Originally, it was necessary to add the resource files in the "qt_add_executable" section of the CMakeList file, and set CMAKE_AUTORCC to ON. Although the images couldn't be seen in the QML Designer of Qt Creator, they were displayed perfectly on the Android emulator.

                1 Reply Last reply
                0
                • Z Z.Johnn has marked this topic as solved

                • Login

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