diff --git a/src/platformtheme/kdeplatformfiledialoghelper.cpp b/src/platformtheme/kdeplatformfiledialoghelper.cpp --- a/src/platformtheme/kdeplatformfiledialoghelper.cpp +++ b/src/platformtheme/kdeplatformfiledialoghelper.cpp @@ -362,10 +362,14 @@ { m_dialog->selectFile(filename); - // Qt 5 at least <= 5.8.0 does not derive the directory from the passed url +#if QT_VERSION < QT_VERSION_CHECK(5, 7, 1) + // Qt 5 at least <= 5.7.1 does not derive the directory from the passed url // and set the initialDirectory option accordingly, also not for known schemes // like file://, so we have to do it ourselves - options()->setInitialDirectory(m_dialog->directory()); + if (QLatin1String(qVersion()) < QLatin1String("5.7.1")) { + options()->setInitialDirectory(m_dialog->directory()); + } +#endif } void KDEPlatformFileDialogHelper::setDirectory(const QUrl &directory)