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 MINGW Resource Issue

Qt MINGW Resource Issue

Scheduled Pinned Locked Moved Unsolved General and Desktop
mingw 64 bitresourcesimagesui design
8 Posts 3 Posters 1.1k 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.
  • R Offline
    R Offline
    rtavakko
    wrote on 5 Jan 2023, 11:58 last edited by
    #1

    Hello all,

    I recently switched my QT 5.14.2 compiler from MSVC2017 to MINGW 64 7.3.0 64 bit on Windows 10 64 bit. The project I'm building is a subdir project, with the subdir projects built as static libraries.

    Each project has a resource file calls 'resources' with all the images, icons etc. stored in it. In the classes of each project, the resources are imported like so:

    Q_INIT_RESOURCE(resources);
    

    During runtime, all loaded images are null. I've used the QT deploy tool to copy the required DLLs and plugins to the executable path. The required image plugins are inside 'imageformat' in the same folder as the executable.

    I'm not sure what I'm doing wrong since my MSVC build works perfectly fine with all the resources loading properly.

    Any tips would be very much appreciated!

    Cheers!

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 5 Jan 2023, 15:40 last edited by
      #2

      First make sure if the resource gets really loaded by checking if the files can be access with QFile::exists(":/..."). If it's the case than you called Q_INIT_RESOURCE() correctly and the needed plugin doesn't get loaded -> see QT_DEBUG_PLUGINS.

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

      R 1 Reply Last reply 10 Jan 2023, 12:03
      1
      • C Christian Ehrlicher
        5 Jan 2023, 15:40

        First make sure if the resource gets really loaded by checking if the files can be access with QFile::exists(":/..."). If it's the case than you called Q_INIT_RESOURCE() correctly and the needed plugin doesn't get loaded -> see QT_DEBUG_PLUGINS.

        R Offline
        R Offline
        rtavakko
        wrote on 10 Jan 2023, 12:03 last edited by
        #3

        @Christian-Ehrlicher QFile::exists returns false. I created an environment variable QT_DEBUG_PLUGINS with a value of 1, how can I debug plugin issues?

        J C 2 Replies Last reply 10 Jan 2023, 12:07
        0
        • R rtavakko
          10 Jan 2023, 12:03

          @Christian-Ehrlicher QFile::exists returns false. I created an environment variable QT_DEBUG_PLUGINS with a value of 1, how can I debug plugin issues?

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 10 Jan 2023, 12:07 last edited by
          #4

          @rtavakko said in Qt MINGW Resource Issue:

          how can I debug plugin issues?

          Start your application after setting QT_DEBUG_PLUGINS and check the output of the application.

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

          1 Reply Last reply
          0
          • R rtavakko
            10 Jan 2023, 12:03

            @Christian-Ehrlicher QFile::exists returns false. I created an environment variable QT_DEBUG_PLUGINS with a value of 1, how can I debug plugin issues?

            C Offline
            C Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 10 Jan 2023, 16:47 last edited by
            #5

            @rtavakko said in Qt MINGW Resource Issue:

            QFile::exists returns false.

            So fix your resource path

            I created an environment variable QT_DEBUG_PLUGINS with a value of 1, how can I debug plugin issues?

            Why do you want to debug the plugins when the file can not be found in the first place?

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

            R 1 Reply Last reply 11 Jan 2023, 13:25
            0
            • C Christian Ehrlicher
              10 Jan 2023, 16:47

              @rtavakko said in Qt MINGW Resource Issue:

              QFile::exists returns false.

              So fix your resource path

              I created an environment variable QT_DEBUG_PLUGINS with a value of 1, how can I debug plugin issues?

              Why do you want to debug the plugins when the file can not be found in the first place?

              R Offline
              R Offline
              rtavakko
              wrote on 11 Jan 2023, 13:25 last edited by
              #6

              @Christian-Ehrlicher How do I fix the resource path? The path seems correct since it is found and resources load correctly when using the MSVC compiler.

              1 Reply Last reply
              0
              • C Offline
                C Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on 11 Jan 2023, 15:33 last edited by
                #7

                You should at least make sure Q_INIT_RESOURCE() is really called before you try to load something from there.

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

                R 1 Reply Last reply 12 Jan 2023, 11:22
                0
                • C Christian Ehrlicher
                  11 Jan 2023, 15:33

                  You should at least make sure Q_INIT_RESOURCE() is really called before you try to load something from there.

                  R Offline
                  R Offline
                  rtavakko
                  wrote on 12 Jan 2023, 11:22 last edited by rtavakko
                  #8

                  @Christian-Ehrlicher What do you mean really make sure?

                  I call it inside the constructor of classes of my static libraries (if the class uses resources).

                  In my GUI application I call it in main after the application class (QApplication in this case) is created and before the main window is created.

                  1 Reply Last reply
                  0

                  5/8

                  10 Jan 2023, 16:47

                  • Login

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