Results 1 to 8 of 8

Thread: How to load icons from resource file

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Join Date
    Feb 2006
    Posts
    157
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: How to load icons from resource file

    Thank you

    I got the solution
    What i did...


    1) I have changed the prefix in .qrc file to ( Images )
    2) Then Added the images.png files from folder ( Images ) to .qrc file.
    3) Added the auto-generated "MyResourcefile.cpp" to Generated files in SolutionExplorer ( VC++ Editor )
    4) In coding ...
    Qt Code:
    1. QAction* actNew_1 = new QAction( QIcon(":Images/Resources/glass_numbers_0.png") , "&New File ..", this);
    To copy to clipboard, switch view to plain text mode 

    5) In "MyRsourcefile.qrc" which is added in Resource Files ( In Solution Explorer )

    [HTML]
    + /Images
    |_____Resources/ImageOne.png
    |_____Resources/ImageTwo.png
    |_____Resources/ImageThree.png
    [/HTML]

    NB: I think the benefit from using Resources files is..........
    1) if you are loading image directly from Imgae folder to coding ,and suppose the imageOne.png is missing in folder , UI will not able to locate the image.
    2) While using resource file , Even if the Imageone.png is missing from Image-Folder , the UI will get he image as it is added in the resources. Is it right or not ...???
    Last edited by jacek; 28th June 2007 at 17:01. Reason: moved [/html] to the right place

Similar Threads

  1. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21
  2. A file browser that uses the native OS icons
    By calin_iaru in forum Newbie
    Replies: 1
    Last Post: 21st May 2007, 12:14
  3. Replies: 2
    Last Post: 8th March 2007, 21:47
  4. Replies: 2
    Last Post: 13th September 2006, 09:11
  5. Resource Collection File maximux size
    By Lele in forum Qt Programming
    Replies: 1
    Last Post: 9th August 2006, 10:41

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.