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 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
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 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
      1
      • Christian EhrlicherC Christian Ehrlicher

        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 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?

        jsulmJ Christian EhrlicherC 2 Replies Last reply
        0
        • R rtavakko

          @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?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on 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

            @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?

            Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 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
            0
            • Christian EhrlicherC Christian Ehrlicher

              @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 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
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on 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
                0
                • Christian EhrlicherC Christian Ehrlicher

                  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 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

                  • Login

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