[Qt-interest] Embed pixmaps at runtime

Constantin Makshin dinosaur-rus at users.sourceforge.net
Mon Feb 16 19:58:59 CET 2009


Thanks for the notice, Frank. I've never had a need to add something to  
the application's executable at runtime and thus hadn't looked for such  
feature in any of Qt tools. :)

But, anyway, modifying executables may be a tricky process (you may need  
to go through the code and fix pointers) and OS may not allow you to do so  
(no permissions, treating executable of a running application as a  
read-only file, etc.).

On Mon, 16 Feb 2009 05:29:13 +0300, Frank Hemer <frank at hemer.org> wrote:
> On Sunday 15 February 2009 18:51:36 Constantin Makshin wrote:
>> Qt resources are embedded right into the code of the application, so you
>> can't easily add Qt resources at runtime. Even if you could, it's likely
>> that your application won't have permissions to modify its executable  
>> file.
>>
>> P.S.: And rcc has nothing to do with the application's executable. It  
>> only
>> generates a C++ header file with all required information about embedded
>> files. Final "embedding" is done by the compiler.
>
> Hmm - no, rcc allows for compiling a resource into a binary format that  
> can be loaded at runtime. Still - except for running rcc via QProcess  
> and adding the resource via QResource::registerResource (...) - there is
> currently no way to achive a runtime resource extension.
> You might take a look at the rcc source - and maybe include parts of it  
> into your application but beware of future changes ...
>
> Btw. there is still a feature request pending on this issue.
>
> Frank
>
>> On Sun, 15 Feb 2009 17:49:44 +0300, Nadia Pio <nadiapio at gmail.com>  
>> wrote:
>>> Hello everybody,
>>> in my application I use some icons that are embedded into the
>>> application's executable through the Qt Resource System.
>>> At runtime the user can import from the file system other icons and
>>> I'd like to add them dynamically (at runtime) to the resource file and
>>> embed them in the application. Is there a way to do this?
>>> I know that I can register external binary resources, but I need to
>>> create the resource data before to register them; is there a way to
>>> run the rcc at runtime?
>>> Thank you.
>>> Nadia

-- 
Constantin "Dinosaur" Makshin



More information about the Qt-interest-old mailing list