Yet another deprecation fix (this is the last one I am aware of)

This commit is contained in:
Juergen Spitzmueller 2021-03-12 12:14:42 +01:00
parent 934c6480c0
commit 9f92fc92bd

View File

@ -368,6 +368,15 @@ void SystemcallPrivate::startProcess(QString const & cmd, string const & path,
string const & lpath, bool detached) string const & lpath, bool detached)
{ {
cmd_ = cmd; cmd_ = cmd;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
// FIXME pass command and arguments separated in the first place
QStringList arguments = QProcess::splitCommand(toqstr(latexEnvCmdPrefix(path, lpath)) + cmd_);
QString command = (arguments.empty()) ? QString() : arguments.first();
if (arguments.size() == 1)
arguments.clear();
else if (!arguments.empty())
arguments.removeFirst();
#endif
if (detached) { if (detached) {
state = SystemcallPrivate::Running; state = SystemcallPrivate::Running;
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
@ -379,7 +388,11 @@ void SystemcallPrivate::startProcess(QString const & cmd, string const & path,
if (err_file_.empty()) if (err_file_.empty())
process_->setStandardErrorFile(QProcess::nullDevice()); process_->setStandardErrorFile(QProcess::nullDevice());
#endif #endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
if (!QProcess::startDetached(command, arguments)) {
#else
if (!QProcess::startDetached(toqstr(latexEnvCmdPrefix(path, lpath)) + cmd_)) { if (!QProcess::startDetached(toqstr(latexEnvCmdPrefix(path, lpath)) + cmd_)) {
#endif
state = SystemcallPrivate::Error; state = SystemcallPrivate::Error;
return; return;
} }
@ -387,7 +400,11 @@ void SystemcallPrivate::startProcess(QString const & cmd, string const & path,
delete released; delete released;
} else if (process_) { } else if (process_) {
state = SystemcallPrivate::Starting; state = SystemcallPrivate::Starting;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
process_->start(command, arguments);
#else
process_->start(toqstr(latexEnvCmdPrefix(path, lpath)) + cmd_); process_->start(toqstr(latexEnvCmdPrefix(path, lpath)) + cmd_);
#endif
} }
} }