Hello,
How do I open a ressource file (qressource
) using the command QDesktopServices::openUrl
?
I tried several ways, but none seemed to work (for instance QDesktopServices::openUrl(QUrl(tr(":ressource.pdf")));
)
Thank you.
Hello,
How do I open a ressource file (qressource
) using the command QDesktopServices::openUrl
?
I tried several ways, but none seemed to work (for instance QDesktopServices::openUrl(QUrl(tr(":ressource.pdf")));
)
Thank you.
Hi,
You shouldn't need to open the resource files if they are added to your qmake project file correctly:
RESOURCES += resources.qrc
Then you should be able to use the files included in your resource file via the syntax you used above:
:/path/filename
(Path and filename inside the resource file)
FYI: QDesktopServices::openUrl is used to open the standard browser with a specific webpage. And, you shouldn't use tr("") on path names etc. only on text displayed to a user (which should be translated for multilingual applications)