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. Qt resource not showing up in static build...
Forum Updated to NodeBB v4.3 + New Features

Qt resource not showing up in static build...

Scheduled Pinned Locked Moved Solved General and Desktop
42 Posts 5 Posters 14.9k Views 4 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.
  • mzimmersM mzimmers

    @SGaist I'm not sure what you mean by "named like that," but I only have one .qrc file, and it only has two files in it.

    kshegunovK Offline
    kshegunovK Offline
    kshegunov
    Moderators
    wrote on last edited by
    #15

    Okay, can you grab a screenshot from the resource editor? Unless that path is an alias, then you need to put the image into that folder under the project. I personally always alias the things because it feels quite clumsy otherwise ...

    Read and abide by the Qt Code of Conduct

    1 Reply Last reply
    0
    • mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote on last edited by mzimmers
      #16

      So I need a subdirectory in my source folder? I'll try that.

      0_1508880996044_resource.PNG

      EDIT: just moved logo to a subfolder, rebuilt and now I'm getting an error:

      [release/qrc_resources.cpp] Error 1

      So I deleted the moved file and re-added it. Still getting the null pixmap error.

      kshegunovK 1 Reply Last reply
      0
      • mzimmersM mzimmers

        So I need a subdirectory in my source folder? I'll try that.

        0_1508880996044_resource.PNG

        EDIT: just moved logo to a subfolder, rebuilt and now I'm getting an error:

        [release/qrc_resources.cpp] Error 1

        So I deleted the moved file and re-added it. Still getting the null pixmap error.

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by
        #17

        @mzimmers said in Qt resource not showing up in static build...:

        just moved logo to a subfolder, rebuilt and now I'm getting an error:

        Not any subfolder, looking at the screenshot you need a folder called logos under your project root. Then readd the file and I think it should work.

        Read and abide by the Qt Code of Conduct

        mzimmersM 1 Reply Last reply
        0
        • kshegunovK kshegunov

          @mzimmers said in Qt resource not showing up in static build...:

          just moved logo to a subfolder, rebuilt and now I'm getting an error:

          Not any subfolder, looking at the screenshot you need a folder called logos under your project root. Then readd the file and I think it should work.

          mzimmersM Offline
          mzimmersM Offline
          mzimmers
          wrote on last edited by mzimmers
          #18

          @kshegunov no joy.

          0_1508882322220_folder.PNG
          EDIT: put some text in here to separate the pics.
          0_1508882354954_qt.PNG

          But at least now it's missing from both the debug and release versions...

          kshegunovK 1 Reply Last reply
          0
          • mzimmersM mzimmers

            @kshegunov no joy.

            0_1508882322220_folder.PNG
            EDIT: put some text in here to separate the pics.
            0_1508882354954_qt.PNG

            But at least now it's missing from both the debug and release versions...

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #19

            But now your resource tree looks funny, you have two folders named "logos" there ...?

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            0
            • mzimmersM Offline
              mzimmersM Offline
              mzimmers
              wrote on last edited by
              #20

              OK, I obviously don't know what's going on here. The resource editor requires me to add a prefix before I can add a file. When I add the file, if it's in a subdirectory, that gets prepended to the file name. This is why you're seeing what appears to be two levels of folders.

              I don't know how to do this differently.

              kshegunovK 1 Reply Last reply
              0
              • mzimmersM mzimmers

                OK, I obviously don't know what's going on here. The resource editor requires me to add a prefix before I can add a file. When I add the file, if it's in a subdirectory, that gets prepended to the file name. This is why you're seeing what appears to be two levels of folders.

                I don't know how to do this differently.

                kshegunovK Offline
                kshegunovK Offline
                kshegunov
                Moderators
                wrote on last edited by
                #21

                Ah, okay. That's why I'm saying it's damn clumsy. Add only a / as prefix and then add your file. It should fix the double folder thing.

                Read and abide by the Qt Code of Conduct

                mzimmersM 1 Reply Last reply
                0
                • kshegunovK kshegunov

                  Ah, okay. That's why I'm saying it's damn clumsy. Add only a / as prefix and then add your file. It should fix the double folder thing.

                  mzimmersM Offline
                  mzimmersM Offline
                  mzimmers
                  wrote on last edited by
                  #22

                  @kshegunov alas, that didn't work, either. You're right, though...this is one awkward interface.

                  kshegunovK 1 Reply Last reply
                  0
                  • mzimmersM mzimmers

                    @kshegunov alas, that didn't work, either. You're right, though...this is one awkward interface.

                    kshegunovK Offline
                    kshegunovK Offline
                    kshegunov
                    Moderators
                    wrote on last edited by kshegunov
                    #23

                    You mean it didn't fix the double folder thing or you still can't load the image?

                    Your resource file should look something like this:
                    0_1508885208545_Screenshot_20171025_014608.png

                    Then you'd load with :/images/20171022_152431.jpg.

                    Read and abide by the Qt Code of Conduct

                    1 Reply Last reply
                    0
                    • mzimmersM Offline
                      mzimmersM Offline
                      mzimmers
                      wrote on last edited by
                      #24

                      Yes my resource file looks similar to yours. The image displays when dynamically built, but not static.

                      kshegunovK 1 Reply Last reply
                      0
                      • mzimmersM mzimmers

                        Yes my resource file looks similar to yours. The image displays when dynamically built, but not static.

                        kshegunovK Offline
                        kshegunovK Offline
                        kshegunov
                        Moderators
                        wrote on last edited by
                        #25

                        Could you try with a static/debug just for the sake of it, to be honest I'm at a lost as you seem to have done everything right.

                        Read and abide by the Qt Code of Conduct

                        1 Reply Last reply
                        0
                        • mzimmersM Offline
                          mzimmersM Offline
                          mzimmers
                          wrote on last edited by
                          #26

                          Static/debug doesn't display the image, either. So I'm doing something wrong with the inclusion of resources into a static build...?

                          kshegunovK 1 Reply Last reply
                          0
                          • mzimmersM mzimmers

                            Static/debug doesn't display the image, either. So I'm doing something wrong with the inclusion of resources into a static build...?

                            kshegunovK Offline
                            kshegunovK Offline
                            kshegunov
                            Moderators
                            wrote on last edited by
                            #27

                            Yes, this would be my best guess. Could you look inside the build folder and see if there's a file .rcc named after your qrc file? Perhaps it's not linked with the binary for some reason ...

                            Read and abide by the Qt Code of Conduct

                            1 Reply Last reply
                            0
                            • mzimmersM Offline
                              mzimmersM Offline
                              mzimmers
                              wrote on last edited by mzimmers
                              #28

                              No .rcc files anywhere. Well, thanks for looking; I guess I'll punt on this for awhile.

                              I did try another image type (.jpg) just to be sure...same results.

                              EDIT: I probably should point out that I have a warning associated with my static version of Qt: "No qmlscene installed." I really can't imagine that this is affecting anything, though.

                              kshegunovK 1 Reply Last reply
                              0
                              • mzimmersM mzimmers

                                No .rcc files anywhere. Well, thanks for looking; I guess I'll punt on this for awhile.

                                I did try another image type (.jpg) just to be sure...same results.

                                EDIT: I probably should point out that I have a warning associated with my static version of Qt: "No qmlscene installed." I really can't imagine that this is affecting anything, though.

                                kshegunovK Offline
                                kshegunovK Offline
                                kshegunov
                                Moderators
                                wrote on last edited by
                                #29

                                No .rcc files anywhere. Well, thanks for looking; I guess I'll punt on this for awhile.

                                Sorry I couldn't be more helpful, perhaps someone else might have an idea, something I didn't think of.

                                Read and abide by the Qt Code of Conduct

                                1 Reply Last reply
                                0
                                • mzimmersM Offline
                                  mzimmersM Offline
                                  mzimmers
                                  wrote on last edited by
                                  #30

                                  I wonder...is it possible that this isn't Qt's fault? That the fault is somewhere within the toolchain? I guess I could try to build my app on Linux or a Mac to see...that'll take a little time, though. Just an idea...

                                  kshegunovK 1 Reply Last reply
                                  0
                                  • mzimmersM mzimmers

                                    I wonder...is it possible that this isn't Qt's fault? That the fault is somewhere within the toolchain? I guess I could try to build my app on Linux or a Mac to see...that'll take a little time, though. Just an idea...

                                    kshegunovK Offline
                                    kshegunovK Offline
                                    kshegunov
                                    Moderators
                                    wrote on last edited by kshegunov
                                    #31

                                    Yes I guess it's a possibility, although probably a remote one. MSVC or MinGW? Because if it's mingw I'd expect it to behave pretty much the same as linux's g++. I'd compile it for you on linux, but the trouble is I don't keep static Qt builds around, I don't believe in static builds so to speak ...

                                    EDIT:
                                    Waaaaaiiit!
                                    Did you load the image plugins in your binary with Q_IMPORT_PLUGIN?

                                    Read and abide by the Qt Code of Conduct

                                    mzimmersM 1 Reply Last reply
                                    0
                                    • kshegunovK kshegunov

                                      Yes I guess it's a possibility, although probably a remote one. MSVC or MinGW? Because if it's mingw I'd expect it to behave pretty much the same as linux's g++. I'd compile it for you on linux, but the trouble is I don't keep static Qt builds around, I don't believe in static builds so to speak ...

                                      EDIT:
                                      Waaaaaiiit!
                                      Did you load the image plugins in your binary with Q_IMPORT_PLUGIN?

                                      mzimmersM Offline
                                      mzimmersM Offline
                                      mzimmers
                                      wrote on last edited by
                                      #32

                                      @kshegunov it's MinGW. This isn't an area I'm especially knowledgeable in, but it seems that it's the toolchain (specifically the linker) that decides what does and doesn't go into an executable.

                                      By the way, if you avoid static images, how do you deliver standalone apps to customers?

                                      mrjjM kshegunovK 2 Replies Last reply
                                      0
                                      • mzimmersM mzimmers

                                        @kshegunov it's MinGW. This isn't an area I'm especially knowledgeable in, but it seems that it's the toolchain (specifically the linker) that decides what does and doesn't go into an executable.

                                        By the way, if you avoid static images, how do you deliver standalone apps to customers?

                                        mrjjM Offline
                                        mrjjM Offline
                                        mrjj
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #33

                                        @mzimmers said in Qt resource not showing up in static build...:

                                        By the way, if you avoid static images, how do you deliver standalone apps to customers?

                                        You can use an install maker
                                        to deliver the .exe and its support dlls.
                                        Qt even has its own tool
                                        http://doc.qt.io/qtinstallerframework/

                                        Static linking requires a Qt license so many of us , do it via an installer.

                                        1 Reply Last reply
                                        1
                                        • mzimmersM mzimmers

                                          @kshegunov it's MinGW. This isn't an area I'm especially knowledgeable in, but it seems that it's the toolchain (specifically the linker) that decides what does and doesn't go into an executable.

                                          By the way, if you avoid static images, how do you deliver standalone apps to customers?

                                          kshegunovK Offline
                                          kshegunovK Offline
                                          kshegunov
                                          Moderators
                                          wrote on last edited by
                                          #34

                                          @mzimmers said in Qt resource not showing up in static build...:

                                          By the way, if you avoid static images, how do you deliver standalone apps to customers?

                                          One of the ways is to compile them in the binary, but as @mrjj noted you can also use an external (compiled) resource file and also you could possibly use an installer that delivers them raw in folders.
                                          What about the Q_IMPORT_PLUGIN question?

                                          Read and abide by the Qt Code of Conduct

                                          mzimmersM 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