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. Unable to load icon image
Forum Updated to NodeBB v4.3 + New Features

Unable to load icon image

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 369 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.
  • A Offline
    A Offline
    abhic
    wrote on last edited by
    #1

    My application (this is independent of Qt) provides a shell interface and this shell interface supports different types of commands. Some commands trigger launching of some GUI(which is QT based) . When user closes the GUI, control returns back to the shell interface.

    2 kind of GUI, GUI1 and GUI2 can be launched with this use model. Depending on what command is used.

    • For GUI1, a different application is launched as a separate process and in current process a Qt event loop is launched to interact with the newly launched application. This internal Qt event loop stops when new application GUI is closed and once event loops stops control returns back to the shell

    • For GUI2 , a QMainWindow is created which among other things has some icons in its toolbar

    Some commands trigger GUI1 and some GUI2

    If commands are executed such that first GUI1 is launched and then its closed and then another command is run which launches GUI2. In this flow some images of icons in toolbar of QMainWindow of GUI2 are not loaded and they are blank. 2 out of 3 images are not loaded. One thing I noticed that icons that didnt load used gif and one that was loaded was a png image

    Now if flow is such that GUI2 is launched first then all icon images load as expected.

    Both times, icon path remains same and I am giving full image path to QIcon. I am not sure what is causing this behavior. Any suggestion on how to debug this?

    1 Reply Last reply
    0
    • GrecKoG Online
      GrecKoG Online
      GrecKo
      Qt Champions 2018
      wrote on last edited by
      #2

      My guess is that the imageformats plugin for gif is not loaded, on my system png doesn't rely on a plugin so that explains the different behavior.
      You might want to check in which working directory is launched GUI2 in both cases.
      Run your GUIs with the QT_DEBUG_PLUGINS env variable set to have more info.

      1 Reply Last reply
      1
      • A Offline
        A Offline
        abhic
        wrote on last edited by abhic
        #3

        Hi @GrecKo , Thank you for replying. I am running both from same directory. Only thing changes is the order of invocation.

        I tried a run with QT_DEBUG_PLUGINS. It does seem something is idfferent between 2 runs wrt gif. In run where icon image is loaded successfully there are some prints about libqgif.so (like a warning about meta data found and at the end unload succeeded for libqgif.so) but in run in which icon image was not loaded properly such prints are not there.

        Any idea why that might be the case? Build is same for both runs , only thing different is order of invocation. Is it that plugins are loaded if needed only during first invocation of QApplication. So if first invocation didnt use some plugin it wont be loaded when we load QApplication again in same session even if it was needed during second invocation.

        I will read more about plugins in this context.

        JonBJ 1 Reply Last reply
        0
        • A abhic

          Hi @GrecKo , Thank you for replying. I am running both from same directory. Only thing changes is the order of invocation.

          I tried a run with QT_DEBUG_PLUGINS. It does seem something is idfferent between 2 runs wrt gif. In run where icon image is loaded successfully there are some prints about libqgif.so (like a warning about meta data found and at the end unload succeeded for libqgif.so) but in run in which icon image was not loaded properly such prints are not there.

          Any idea why that might be the case? Build is same for both runs , only thing different is order of invocation. Is it that plugins are loaded if needed only during first invocation of QApplication. So if first invocation didnt use some plugin it wont be loaded when we load QApplication again in same session even if it was needed during second invocation.

          I will read more about plugins in this context.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @abhic said in Unable to load icon image:

          when we load QApplication again in same session

          This may or may not be relevant. Are you saying the way your shell works when invoking GUI1/2 is to create a new QApplication object each time? And you destroy it after use each time. As opposed to allowing one instance of QApplication to persist and use it for each of GUI1/2 when wanted?

          Your code itself is not a plugin, right? (That was just @GrecKo asking about image formats plugin itself.)

          1 Reply Last reply
          0
          • A Offline
            A Offline
            abhic
            wrote on last edited by
            #5

            Yes we create new QApplication each time and destroy it when GUI is closed. Is this not recommended?
            Our code is not a plugin. We create QApplication from within shell executable.

            And it does seem qt plugin for gif (libqgif.so) is somehow not loading in the flow when GUI1 is launched first and it was loaded when GUI2 was run first

            JonBJ 1 Reply Last reply
            0
            • A abhic

              Yes we create new QApplication each time and destroy it when GUI is closed. Is this not recommended?
              Our code is not a plugin. We create QApplication from within shell executable.

              And it does seem qt plugin for gif (libqgif.so) is somehow not loading in the flow when GUI1 is launched first and it was loaded when GUI2 was run first

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @abhic said in Unable to load icon image:

              Yes we create new QApplication each time and destroy it when GUI is closed. Is this not recommended?

              I don't know, but you are reporting "unusual" behaviour. If it's easy to change temporarily to persist the QApplication instance either from start up or first invocation across future requests it might be interesting to check whether that has any effect on observed behaviour.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                abhic
                wrote on last edited by
                #7

                Thanks for your reply. I will convert my image to png only to avoid this issue

                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