Results 1 to 5 of 5

Thread: why QDesktopServices::openUrl() open a file slowly for the first time

  1. #1
    Join Date
    May 2009
    Posts
    4
    Thanks
    1

    Default why QDesktopServices::openUrl() open a file slowly for the first time

    I use QDesktopServices:penUrl() to open a file(.doc,xls,pdf), it takes 30-60 seconds to open file(.doc) for the first time, after that, it only takes 1-5 seconds to open anther file(.doc).it is same to file(xls, pdf).
    Why it takes long time to open file for the first time?

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: why QDesktopServices::openUrl() open a file slowly for the first time

    It looks for best matched application to open the particular URL. I think this searches in file associations. And this first time trick is with all things we do on a machine. Everything we opens is slower for first time than opening same ting afterward.

  3. #3
    Join Date
    May 2009
    Posts
    4
    Thanks
    1

    Default Re: why QDesktopServices::openUrl() open a file slowly for the first time

    Quote Originally Posted by yogeshgokul View Post
    It looks for best matched application to open the particular URL. I think this searches in file associations. And this first time trick is with all things we do on a machine. Everything we opens is slower for first time than opening same ting afterward.
    How can i make QDesktopServices:penUrl() open file speed up for first time?

  4. #4
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: why QDesktopServices::openUrl() open a file slowly for the first time

    There is very less you can do. Dfragment ur HDD or just replace it with higher RPM one. Kidding..

    Just try to use this:
    Qt Code:
    1. QDesktopServices::openUrl(QUrl("file:///C:/Documents and Settings/All Users/Desktop", QUrl::StrictMode));
    To copy to clipboard, switch view to plain text mode 
    NOTICE QUrl::StrictMode
    This should not make significant change but may be. Dont forget, that this will not check for validity of URL. Thats why it can speed up.

  5. #5
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Thanks
    11
    Thanked 16 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: why QDesktopServices::openUrl() open a file slowly for the first time

    I think this is not a fault of Qt. If you open a doc the first time Word (the program) needs to be completely loaded into the memory. This takes a long time. If you open a second doc Word is already in memory (even if word was closed) and only the doc needs to be loaded.

    I dont think, that using Strictmode for QUrl will have any significant speed improvements.

Similar Threads

  1. QDesktopServices open url & local file & pdf or doc
    By patrik08 in forum Qt Programming
    Replies: 9
    Last Post: 14th April 2012, 05:42
  2. Restrict user to open the same file
    By vermarajeev in forum General Programming
    Replies: 33
    Last Post: 25th May 2007, 09:15
  3. How to open a Pdf file from Qt
    By vishal.chauhan in forum Newbie
    Replies: 2
    Last Post: 28th March 2007, 09:24
  4. Qt 4.1.4 on VS2005 error- cannot open input file 'qtmain.lib'
    By Ashish in forum Installation and Deployment
    Replies: 10
    Last Post: 11th October 2006, 17:05
  5. QProcess open all file -> url.dll,FileProtocolHandler
    By patrik08 in forum Qt Programming
    Replies: 2
    Last Post: 26th June 2006, 18:07

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.