Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Statically compiled image resources

Statically compiled image resources

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 373 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.
  • N Offline
    N Offline
    Nan Feng
    wrote on last edited by
    #1

    Hi, good cousin. During the static compilation test, I found that there are many image resources embedded in the .exe that are not used in the project. What is the situation?
    Is there any way to prevent him from embedding image resources that are not used by the project?
    Link: https://pan.baidu.com/s/1UiulA5_O1FYdbifa3CFk5g
    Extraction code: 0000

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

      @Nan-Feng said in Statically compiled image resources:

      Is there any way to prevent him from embedding image resources that are not used by the project?

      Don't add them to the resource files.

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

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Nan Feng
        wrote on last edited by
        #3

        But in fact, I didn’t add the pictures in the screenshot to the resource file
        My .qrc is as follows:
        Link: https://pan.baidu.com/s/1JYnCRXMH7snabboxnBwkDA
        Extraction code: 0000

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

          @Nan-Feng said in Statically compiled image resources:

          I didn’t add the pictures in the screenshot to the resource file

          You did, otherwise you would not see them there.

          My .qrc is as follows:

          a qrc file is an ascii file, don't post screenshots...

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

          1 Reply Last reply
          0
          • N Offline
            N Offline
            Nan Feng
            wrote on last edited by
            #5

            The content of the .qrc file is as follows: there are all pictures used in my project, and there are no unused pictures in the screenshots. Is it static compilation? I don’t know if I need those pictures, but the compiler is a little cautious, so give me Is the compilation coming in?

            <RCC>
            <qresource prefix="/">
            <file>images/complete_left.png</file>
            <file>images/welcome_left.png</file>
            <file>images/title_ico.png</file>
            <file>images/close_light.png</file>
            <file>images/instdir_left.png</file>
            <file>images/warn.png</file>
            <file>images/abort_left.png</file>
            <file>images/license_left.png</file>
            <file>images/uncheckBox.png</file>
            <file>images/uncheckBoxHover.png</file>
            <file>images/checked.png</file>
            <file>images/checkedHover.png</file>
            <file>images/installing_left.png</file>
            <file>pluginFiles/Depth Of Field Generator PRO.AEX</file>
            <file>images/readyinst_left.png</file>
            <file>images/langdialog_left.png</file>
            </qresource>
            </RCC>

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

              I still don't understand your problem. Also don't know what the first image shows. The only way to iterate over the files in embedded via qrc files is to use QDir/QDirIterator and not any external program.

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

              1 Reply Last reply
              0
              • N Offline
                N Offline
                Nan Feng
                wrote on last edited by
                #7

                What I mean is that some image resources that are not used in my project have also been compiled. How can I prevent him from compiling unused image resources? The picture resources I mentioned are not in the qrc file. It is the display picture in the screenshot below. These pictures are obtained by extracting the compiled .exe file.
                Link: https://pan.baidu.com/s/1fRXGTzFn2BxZ0Aptpoy1Sg
                Extraction code: 0000

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

                  They don't come from your qrc file but from another one (e.g. Qt libs / plugins). You can not remove them and the linker also can't remove them since you and the linker don't know if they're used or not.

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

                  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