Results 1 to 2 of 2

Thread: Problem with qurl and fromlocalfile

  1. #1
    Join Date
    Jan 2007
    Posts
    95
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Problem with qurl and fromlocalfile

    I want to open a pdf file with the default browser. I try this:

    Qt Code:
    1. QString path=QApplication::applicationDirPath()+"/manual.pdf";
    2. QUrl url;
    3. url.fromLocalFile(path);
    4. QDesktopServices::openUrl(url);
    To copy to clipboard, switch view to plain text mode 

    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

  2. #2
    Join Date
    Jan 2007
    Posts
    95
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with qurl and fromlocalfile

    Solved.

    Qt Code:
    1. QString path=QApplication::applicationDirPath()+"/manual.pdf";
    2. bool r = QDesktopServices::openUrl(QUrl::fromLocalFile(path));
    To copy to clipboard, switch view to plain text mode 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.