Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

qt registerresource from raw data

Tags:

c++

qt

I am just starting to learn about the QResource. As I understand it, it is just a way to create a "directory/File" structure in memory.

I'd like my application to create a resource (at run time) from a raw data. E.g. my application could create a image resulting from some computation and would want to save it as a resource for further usage.

I thought that the constructor:

QResource::registerResource( const uchar * rccData, const QString & mapRoot = QString()

was meant to do that, but I probably missed something as I expected a size argument...

what is rccData then?

How big the the created resource?

How can I create a resource from raw data?

Thanks in advance for your answers.

like image 568
user1159290 Avatar asked Aug 14 '26 16:08

user1159290


1 Answers

QResource gives you access to data stored in resource files .qrc. These files inherit a directorylike structure, which then can be accessed through the QResource class. These files can be compiled into the application or can be loaded at runtime via QResource::QResource ( const QString & file = QString(), const QLocale & locale = QLocale() ) consructutor. Those loaded files then virtually repesent a directory structure in memory, but QResource is not meant to create a directory structure out of nothing.

like image 78
Sebastian Lange Avatar answered Aug 16 '26 20:08

Sebastian Lange



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!