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. Image resource, showing in Qt Creator but not at runtime.
Qt 6.11 is out! See what's new in the release blog

Image resource, showing in Qt Creator but not at runtime.

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 399 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by SPlatten
    #1

    I have an image resource which has the alias ICN_CONNTD the image is a png file and is 64x64. In the source I have:

    mppmConnected = new Pixmap(":/ICN_CONNTD");
    

    If I hover the mouse of the above line the image is displayed in a hovering context display. When I debug in Qt Creator and stop at the above line then step over it, mppmConnected is returned as (0x0) and highlighted as red.

    Why isn't this working? I have use exactly the same method in another project and that works fine.

    commsTester.qrc:

    <RCC>
        <qresource prefix="/">
            <file alias="ICN_CONNTD">../res/conntd.png</file>
            <file alias="ICN_DISCONTD">../res/discontd.png</file>
        </qresource>
    </RCC>
    

    Kind Regards,
    Sy

    J.HilkJ 1 Reply Last reply
    0
    • SPlattenS SPlatten

      I have an image resource which has the alias ICN_CONNTD the image is a png file and is 64x64. In the source I have:

      mppmConnected = new Pixmap(":/ICN_CONNTD");
      

      If I hover the mouse of the above line the image is displayed in a hovering context display. When I debug in Qt Creator and stop at the above line then step over it, mppmConnected is returned as (0x0) and highlighted as red.

      Why isn't this working? I have use exactly the same method in another project and that works fine.

      commsTester.qrc:

      <RCC>
          <qresource prefix="/">
              <file alias="ICN_CONNTD">../res/conntd.png</file>
              <file alias="ICN_DISCONTD">../res/discontd.png</file>
          </qresource>
      </RCC>
      
      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @SPlatten have you (explicitly) rerun qmake after adding the image to your resource file?


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      SPlattenS 1 Reply Last reply
      2
      • J.HilkJ J.Hilk

        @SPlatten have you (explicitly) rerun qmake after adding the image to your resource file?

        SPlattenS Offline
        SPlattenS Offline
        SPlatten
        wrote on last edited by
        #3

        @J-Hilk , Yes, just to be sure, have cleaned, run qmake and rebuild again. Now its all good.

        Kind Regards,
        Sy

        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