Results 1 to 3 of 3

Thread: QImage load() - Not finding updated image

  1. #1
    Join Date
    Apr 2014
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    5

    Default QImage load() - Not finding updated image

    Hi

    I am working on a linux Virtual Machine on Windows 8.

    I have a UI which displays various different images, I have modified one of these image resources however when I run the program, the original image is still used. I have tried removing every single image from the folder that QT uses to load them from, in the hopes that this would at least stop any image being loaded, however once again the original images are used in each case, despite them not technically being in the folder that QImage's load method is using.

    I believe that the resources may somehow be getting embedded into the executable (http://qt-project.org/doc/qt-4.8/resources.html), however I have no idea if this is the case or not.

    My question is: How do I get QT to use the updated version of an image file?

    Qt Code:
    1. // Setup the path to the image file
    2. std :: string m_imagePath = ":/ErrorImages/NoImageExpected.png";
    3.  
    4. // Load the image file
    5. m_image.load( m_imagePath.c_str() );
    6.  
    7. // At runtime, the original image is displayed every time - despite it being amended, and in a separate test case, removed completely
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanked 342 Times in 324 Posts

    Default Re: QImage load() - Not finding updated image

    I believe that the resources may somehow be getting embedded into the executable (http://qt-project.org/doc/qt-4.8/resources.html), however I have no idea if this is the case or not.
    So you don't know if you have created .qrc file and have "RESOURCES += file.qrc" entry in your .pro file ?
    Anyway, file path structure looks like a path to embedded resource, so in order to make the change visible you need to update the resource file and rebuild the application.

  3. The following user says thank you to stampede for this useful post:

    Chris2oph (7th April 2014)

  4. #3
    Join Date
    Apr 2014
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    5

    Default Re: QImage load() - Not finding updated image

    Many thanks for your response, I shall give this a try and hopefully it will help me resolve this issue

Similar Threads

  1. [Qt4] How to load Url image into QImage?
    By Gonzalez in forum Qt Programming
    Replies: 6
    Last Post: 13th October 2014, 10:10
  2. Replies: 1
    Last Post: 15th September 2013, 22:16
  3. [mac] QImage.load fails
    By snoopy67 in forum Qt Programming
    Replies: 4
    Last Post: 7th November 2007, 14:06
  4. Finding marks on scanned image for alignment
    By caduel in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2007, 02:10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.