forked from osmocom/wireshark
Qt: Refactor to avoid deprecation warning on Windows
This commit is contained in:
parent
79da670bd1
commit
59b5c83e4c
|
@ -191,21 +191,18 @@ bool qStringCaseLessThan(const QString &s1, const QString &s2)
|
||||||
return s1.compare(s2, Qt::CaseInsensitive) < 0;
|
return s1.compare(s2, Qt::CaseInsensitive) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/3490336/how-to-reveal-in-finder-or-show-in-explorer-with-qt
|
|
||||||
void desktop_show_in_folder(const QString file_path)
|
void desktop_show_in_folder(const QString file_path)
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
// https://stackoverflow.com/questions/3490336/how-to-reveal-in-finder-or-show-in-explorer-with-qt
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
const QFileInfo fileInfo(file_path);
|
QString command = "explorer.exe";
|
||||||
|
QStringList arguments;
|
||||||
|
|
||||||
QString path = QDir::toNativeSeparators(file_path);
|
QString path = QDir::toNativeSeparators(file_path);
|
||||||
/* See comment at https ://stackoverflow.com/questions/3490336/how-to-reveal-in-finder-or-show-in-explorer-with-qt
|
arguments << "/select," << path + "";
|
||||||
* Apparently, Windows does not like quoted paths in Select statements, when given as arguments. So they are run as a command
|
success = QProcess::startDetached(command, arguments);
|
||||||
*/
|
|
||||||
QString command = "explorer.exe /select," + path + "";
|
|
||||||
success = QProcess::startDetached(command);
|
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
QStringList script_args;
|
QStringList script_args;
|
||||||
QString escaped_path = file_path;
|
QString escaped_path = file_path;
|
||||||
|
|
Loading…
Reference in New Issue