[Qt-interest] Slow response when opening URL using QDesktopServices
Jaco Naude
naude.jaco at gmail.com
Mon May 18 11:00:12 CEST 2009
Hi
I am experiencing some strange behavior when opening a older on windows
using QDesktopServices. My code is below. It basically gets a file name,
removes the file name from the path and then tries to open the folder.
void MainWindow::openFolder(const QString& folder_to_open) {
btnClearLogClick();
QDir folder_dir;
folder_dir.setPath(folder_dir.fromNativeSeparators(folder_to_open));
QStringList folder_tokens = folder_dir.absolutePath().split("/");
if (folder_tokens.size() == 0) {
logMessage("",MainWindow::Info);
logMessage(QString("An error occurred when analyzing the file's
path."),MainWindow::Error);
return;
}
folder_tokens.pop_back();
QString folder_analyzed = folder_tokens.join("/");
logMessage(QString("Opening folder:
%1").arg(folder_analyzed),MainWindow::Info);
QDesktopServices explorer_service;
explorer_service.openUrl(QUrl(QString("file:%1").arg(folder_analyzed)));
}
When I run this function, the GUI freezes for about 10 seconds and then
responds by opening the correct folder. When I debug it and step through the
function it works perfectly and I don't notice any delays. It only happens
the first time the application is opened, thus calling this function for a
second and third time etc. does not cause the delay.
Any ideas of what may cause thing?
Thanks,
Jaco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090518/b4af4078/attachment.html
More information about the Qt-interest-old
mailing list