tags:

views:

197

answers:

2

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.

+1  A: 

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)

Andreas Wallner
+3  A: 
Vereb
Thank you. I did a QFile::copy (":/ressource.pdf", "ressource.pdf"); and then a QDesktopServices::openUrl and it works perfecly :)
Klaus