PTBG
PTBG

Reputation: 595

Qt resource file workaround

I'm developing a desktop app in Qt. I need it to be very configurable, and as a result of that, the filenames of pictures/files I need to use are dynamic. i.e depending on which user logs in, a different picture will need to be displayed. That being said, I need a way to load pictures in a QtGraphicsScene by specifying a path only; I don't know what the files will be, so I can't put them in the resource file. From what I understand, any pictures have to be declared in the resource file. So my question is:

How do I achieve my goal of using pictures in my application without a resource file OR how can I make the resource file dynamic?

Upvotes: 1

Views: 542

Answers (1)

cmannett85
cmannett85

Reputation: 22376

Resource file data is compiled into the executable/library, so it by definition cannot be dynamic. However Qt can load images at runtime from external files in several ways, the easiest being to use QImage.

Upvotes: 5

Related Questions