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. Problem with application icon
Forum Updated to NodeBB v4.3 + New Features

Problem with application icon

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 3 Posters 1.9k Views 1 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.
  • J Offline
    J Offline
    JCBaraza
    wrote on last edited by
    #1

    Hi all,

    I've developped an application with Qt Creator 2.4.1 (particularly, with Qt 4.8.1 for Desktop - MinGW (Qt SDK)). This app has an icon that I've assigned to the main window. When I run the app in debug mode, the icon in the main window appears normally:

    0_1523734700284_DebugRun.png

    but when I run the release version, it doesn't:

    0_1523734725284_ReleaseRun.png

    Can you please tell me what I am doing wrong? I've assigned the icon to the main window from a qrc file, like this:

    0_1523734835066_MainWindow_IconSelection.png

    This is the contents of the qrc file:

    <RCC>
        <qresource prefix="/">
            <file>VFIT-red.ico</file>
        </qresource>
    </RCC>
    

    And this is the contents of the pro file:

    #-------------------------------------------------
    #
    # Project created by QtCreator 2017-10-28T22:20:02
    #
    #-------------------------------------------------
    
    QT       += core gui xml network
    
    TARGET = VFIT
    TEMPLATE = app
    RC_FILE = VFIT.rc
    
    SOURCES += main.cpp\
            mainwindow.cpp \
        designselector.cpp \
        viewlistclassificator.cpp \
        RandGenParList.cpp \
        RandGenPar.cpp \
        FaultModelParList.cpp \
        FaultModelPar.cpp \
        InjectionConfiguration.cpp \
        TargetParList.cpp \
        TargetPar.cpp \
        RangePar.cpp \
        RangeParList.cpp \
        ViewListParList.cpp \
        ViewListPar.cpp \
        TcpClient.cpp
    
    HEADERS  += mainwindow.h \
        designselector.h \
        viewlistclassificator.h \
        BasicDeclarations.h \
        RandGenParList.h \
        RandGenPar.h \
        FaultModelParList.h \
        FaultModelPar.h \
        InjectionConfiguration.h \
        TargetParList.h \
        TargetPar.h \
        RangePar.h \
        RangeParList.h \
        ViewListParList.h \
        ViewListPar.h \
        TcpClient.h
    
    FORMS    += mainwindow.ui \
        designselector.ui \
        viewlistclassificator.ui \
        TcpClient.ui
    
    RESOURCES += \
        VFIT.qrc
    
    

    I know this is a minor problem, but it's making me crazy. I've tried even copying the icon file in the same path as the exe (just in the same way as with the dlls to be able to run the exe).

    Anyway, I'd like to know if it is due to a programming mistake.

    Thanks in advance,

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Pretty strange. Can you do a quick check ? Print a debug message with the return value of QFile::exists on the path to your icon file. It should return true both time.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 2 Replies Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        The ico image format is provided via a plugin in Qt4 and Qt5 so I guess the release version of this plugin is not found / shipped with the application.

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

        J 2 Replies Last reply
        1
        • SGaistS SGaist

          Hi,

          Pretty strange. Can you do a quick check ? Print a debug message with the return value of QFile::exists on the path to your icon file. It should return true both time.

          J Offline
          J Offline
          JCBaraza
          wrote on last edited by JCBaraza
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            The ico image format is provided via a plugin in Qt4 and Qt5 so I guess the release version of this plugin is not found / shipped with the application.

            J Offline
            J Offline
            JCBaraza
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              Pretty strange. Can you do a quick check ? Print a debug message with the return value of QFile::exists on the path to your icon file. It should return true both time.

              J Offline
              J Offline
              JCBaraza
              wrote on last edited by
              #6

              @SGaist said in Problem with application icon:

              Hi,

              Pretty strange. Can you do a quick check ? Print a debug message with the return value of QFile::exists on the path to your icon file. It should return true both time.

              Hi @SGaist,

              Thank you for your quick answer. I've tried asking for the existence ico file, as you suggested, and it was found in both cases. Then, with this same idea, I've asked for the name of the MainWindow icon (at the very beginning of the constructor):

              qDebug() << "this->windowIcon().name()" << this->windowIcon().name();
              

              and, surprisingly, the answer has been "" in both cases, even though in debug mode the icon actually appeared!

              I'm really shocked...

              1 Reply Last reply
              0
              • Christian EhrlicherC Christian Ehrlicher

                The ico image format is provided via a plugin in Qt4 and Qt5 so I guess the release version of this plugin is not found / shipped with the application.

                J Offline
                J Offline
                JCBaraza
                wrote on last edited by
                #7

                @Christian-Ehrlicher said in Problem with application icon:

                The ico image format is provided via a plugin in Qt4 and Qt5 so I guess the release version of this plugin is not found / shipped with the application.

                Hi @Christian-Ehrlicher,

                Thanks you a lot for your quick answer.

                And how could I ship it? Copying all the Qt plugings to the application main path, and then erasing them one by one until getting what's the right one? At least, with the dlls, the proper app issues subsquent error messages indicating which dll is missing each time...

                J 1 Reply Last reply
                0
                • J JCBaraza

                  @Christian-Ehrlicher said in Problem with application icon:

                  The ico image format is provided via a plugin in Qt4 and Qt5 so I guess the release version of this plugin is not found / shipped with the application.

                  Hi @Christian-Ehrlicher,

                  Thanks you a lot for your quick answer.

                  And how could I ship it? Copying all the Qt plugings to the application main path, and then erasing them one by one until getting what's the right one? At least, with the dlls, the proper app issues subsquent error messages indicating which dll is missing each time...

                  J Offline
                  J Offline
                  JCBaraza
                  wrote on last edited by
                  #8

                  @JCBaraza said in Problem with application icon:

                  @Christian-Ehrlicher said in Problem with application icon:

                  The ico image format is provided via a plugin in Qt4 and Qt5 so I guess the release version of this plugin is not found / shipped with the application.

                  Hi @Christian-Ehrlicher,

                  Thanks you a lot for your quick answer.

                  And how could I ship it? Copying all the Qt plugings to the application main path, and then erasing them one by one until getting what's the right one? At least, with the dlls, the proper app issues subsquent error messages indicating which dll is missing each time...

                  Hi again,

                  As the application icon is a 16x16 ico file, I've tried copying one by one the "qico*.dll" files (well, not all actually; I've tried only the "qico4.dll" and "qicod4.dll" files in "Desktop\Qt\4.8.1\mingw\plugins\imageformats", "Desktop\Qt\4.7.4\mingw\plugins\imageformats", "Simulator\Qt\mingw\plugins\imageformats", "Simulator\Application\plugins\imageformats" and "QtCreator\bin\imageformats" folders). But I'm affraid that nothing has changed. The icon is still missing in the min window.

                  Should I try other plugins? Any other suggestions, please?

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

                    You have to make sure to ship the correct plugin which fits to your version of the shipped Qt dlls. Also they should reside under <appdir>\plugins\type. See http://doc.qt.io/archives/qt-4.8/deployment-plugins.html (chapter 'The Plugin Directory' - the rest is not needed in your case) for more information

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

                    J 1 Reply Last reply
                    2
                    • Christian EhrlicherC Christian Ehrlicher

                      You have to make sure to ship the correct plugin which fits to your version of the shipped Qt dlls. Also they should reside under <appdir>\plugins\type. See http://doc.qt.io/archives/qt-4.8/deployment-plugins.html (chapter 'The Plugin Directory' - the rest is not needed in your case) for more information

                      J Offline
                      J Offline
                      JCBaraza
                      wrote on last edited by
                      #10

                      @Christian-Ehrlicher said in Problem with application icon:

                      You have to make sure to ship the correct plugin which fits to your version of the shipped Qt dlls. Also they should reside under <appdir>\plugins\type. See http://doc.qt.io/archives/qt-4.8/deployment-plugins.html (chapter 'The Plugin Directory' - the rest is not needed in your case) for more information

                      Hi Christian-Ehrlicher,

                      Wow! It's been hard to understand so much information about application deployment, but I finally got it. Thank you so much.

                      Once you know that you have to generate a folder in your application path (or wherever else, actually) to copy the required plugins, it's just a "simple" brute force task. I've seen that this is a recurrent problem, so I include the "algorithm" in case it's useful for someone in the future:
                      1.- Copy all the plugin subfolders hanging from "your" particular Qt plugins folder (in my case, "Desktop\Qt\4.8.1\mingw\plugins").
                      2.- Add the local plugin path to the application path (with addLibraryPath(localPluginPath)) and build the application.
                      3.- For each local plugin subfolder:
                      a) Rename (for instance, starting with a "_").
                      b) Run the release version of the application.
                      If it works, the subfolder is not necessary => You can delete it (in my case I haven't done, just in case; I'll do when the application is completely terminated and tested).
                      If it does not work, some plugin in the subfolder is required => Undo the name change.
                      4.- For each non-renamed local plugin folder:
                      a) For each plugin (DLL file) in the subfolder:
                      i) Rename.
                      ii) Run the release version of the application.
                      If it works, the plugin is not necessary => You can delete it.
                      If it doesn't work, the plugin is required => Undo the name change.

                      Actually, I was very close yesterday: when I copied the "qico4.dll" plugin, I only needed to add the local plugin path to my application and rebuild, because finally this is the only plugin that I need so far.

                      Thanks again to all.

                      Best regards,

                      1 Reply Last reply
                      1

                      • Login

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