PDA

View Full Version : Problem with qurl and fromlocalfile



zorro68
19th June 2008, 20:26
I want to open a pdf file with the default browser. I try this:



QString path=QApplication::applicationDirPath()+"/manual.pdf";
QUrl url;
url.fromLocalFile(path);
QDesktopServices::openUrl(url);


The path variable is ok, but the url variable is empty. Anyone knows what happend? or how to open a pdf file with qt (only a viewer)?

Thanks in advance

zorro68
19th June 2008, 20:44
Solved.



QString path=QApplication::applicationDirPath()+"/manual.pdf";
bool r = QDesktopServices::openUrl(QUrl::fromLocalFile(path ));