Results 1 to 3 of 3

Thread: Add files to resources dynamically

  1. #1
    Join Date
    Apr 2012
    Posts
    21
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Add files to resources dynamically

    Is it possible to add files to existing resources (.qrc) file, but dynamically, from C++ code?

    I already created images.qrc and put some image files in it. Now i want to load some objects during the app execution time, and add images from loaded objects' filepaths to existing resource file.

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

    Default Re: Add files to resources dynamically

    Resource files (.qrc) are used by rcc tool to create .cpp source code, which is then compiled into the executable. In order to add new file to resource system you have to recompile the project.
    add images from loaded objects' filepaths to existing resource file.
    Can you explain what is your goal, why can't you just load the image via QImage/QPixmap class interface ? You want to put the image into resource system in order to use it later, right ? So why can't you just use it with QImage::load etc. methods ?

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

    juracist (25th June 2014)

  4. #3
    Join Date
    Apr 2012
    Posts
    21
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Add files to resources dynamically

    Thanks, I just loaded it via QPixmap and it works great!

Similar Threads

  1. Is it possible to add QT resources to a DLL?
    By cboles in forum Qt Programming
    Replies: 4
    Last Post: 17th January 2017, 00:12
  2. Replies: 0
    Last Post: 27th October 2010, 15:57
  3. Do resources in QRC files consume memory?
    By TheNewGuy in forum Newbie
    Replies: 1
    Last Post: 7th December 2009, 08:07
  4. Resources files (.qrc) not working
    By degs2k4 in forum Qt Programming
    Replies: 16
    Last Post: 21st February 2008, 09:54
  5. Replies: 2
    Last Post: 17th July 2007, 17:05

Tags for this Thread

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.