Results 1 to 4 of 4

Thread: Qt-creator adding image problem

  1. #1

    Default Qt-creator adding image problem

    Hello,

    I am trying to add image to my widget. I made a resource file and upload the image there. I can succesfully see the image as I want. But when I delete the original image file from folder QLabel becomes empty. How can i overcome this problem? I dont want the program file includes icon or image file.
    Regards

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt-creator adding image problem

    Show the code where you load the image from the resource file.

  3. #3
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt-creator adding image problem

    Just guessing so that I can be wrong. You are running the app from the Qt Creator and you have deleted the image from the project resources. If it is so, Qt Creator will recompile your app and it finds no image.
    As far as the project files are concerned, the image must be in the resources folder. The image gets really embedded in your executable and you do not need to distribute the image along with your app. Test:
    (1) Return the image to the resources. Recompile.
    (2) Copy the executable somewhere else. Run. You should see the image.
    (3) Remove the image from the resources (temporarily). Run the copy you have made in (2). You should see the image.
    (4) Return the image to the project resources, it belongs there. Recompile, because meddling with the resources made your executable (in the Qt Creator) invalid.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt-creator adding image problem

    Quote Originally Posted by sageofsixpath View Post
    But when I delete the original image file from folder QLabel becomes empty.
    When you say you delete the original image, do you mean the image referenced by the resource file?
    If yes, how do you expect the resource compiler to build it into the executable if it is not there anymore?

    Cheers,
    _

Similar Threads

  1. Adding -O3 compiler option in Qt Creator
    By Momergil in forum Qt Tools
    Replies: 4
    Last Post: 28th June 2014, 02:09
  2. Adding QAxWidget Plugin to Qt creator 2.5.2
    By astodolski in forum Newbie
    Replies: 0
    Last Post: 19th October 2012, 15:58
  3. Adding MinGW to build configuration in Qt Creator
    By Tamimi in forum Installation and Deployment
    Replies: 1
    Last Post: 18th November 2011, 04:28
  4. Creator 4.5.2 crash adding INCLUDEPATH
    By PUK_999 in forum Newbie
    Replies: 11
    Last Post: 17th August 2009, 20:38
  5. Replies: 0
    Last Post: 14th December 2007, 01:33

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.