forked from qt-creator/qt-creator
Utils: Fix compile for UNIX when using Qt5.9
QProcess::startDetached(qint64 *) has been introduced in Qt5.10. When using Qt5.9 just use the old way where it was not possible to set the environment for the process. Additionally disable the respective UI part to avoid complaining users. Amends626665b7a4and72ada44be3. Change-Id: I34233402fe385035566484431838dd6edbda483e Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -436,7 +436,11 @@ bool ConsoleProcess::startTerminalEmulator(QSettings *settings, const QString &w
|
|||||||
const Utils::Environment &env)
|
const Utils::Environment &env)
|
||||||
{
|
{
|
||||||
const TerminalCommand term = terminalEmulator(settings);
|
const TerminalCommand term = terminalEmulator(settings);
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
||||||
|
// for 5.9 and below we cannot set the environment
|
||||||
|
return QProcess::startDetached(term.command, QtcProcess::splitArgs(term.openArgs),
|
||||||
|
workingDir);
|
||||||
|
#else
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.setProgram(term.command);
|
process.setProgram(term.command);
|
||||||
process.setArguments(QtcProcess::splitArgs(term.openArgs));
|
process.setArguments(QtcProcess::splitArgs(term.openArgs));
|
||||||
@@ -444,6 +448,7 @@ bool ConsoleProcess::startTerminalEmulator(QSettings *settings, const QString &w
|
|||||||
process.setWorkingDirectory(workingDir);
|
process.setWorkingDirectory(workingDir);
|
||||||
|
|
||||||
return process.startDetached();
|
return process.startDetached();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
|||||||
@@ -207,8 +207,9 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetails
|
|||||||
d->m_terminalButton = new QPushButton(this);
|
d->m_terminalButton = new QPushButton(this);
|
||||||
d->m_terminalButton->setText(tr("Open &Terminal"));
|
d->m_terminalButton->setText(tr("Open &Terminal"));
|
||||||
d->m_terminalButton->setToolTip(tr("Open a terminal with this environment set up."));
|
d->m_terminalButton->setToolTip(tr("Open a terminal with this environment set up."));
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||||
buttonLayout->addWidget(d->m_terminalButton);
|
buttonLayout->addWidget(d->m_terminalButton);
|
||||||
|
#endif
|
||||||
buttonLayout->addStretch();
|
buttonLayout->addStretch();
|
||||||
|
|
||||||
horizontalLayout->addLayout(buttonLayout);
|
horizontalLayout->addLayout(buttonLayout);
|
||||||
@@ -231,10 +232,8 @@ EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetails
|
|||||||
this, &EnvironmentWidget::batchEditEnvironmentButtonClicked);
|
this, &EnvironmentWidget::batchEditEnvironmentButtonClicked);
|
||||||
connect(d->m_environmentView->selectionModel(), &QItemSelectionModel::currentChanged,
|
connect(d->m_environmentView->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||||
this, &EnvironmentWidget::environmentCurrentIndexChanged);
|
this, &EnvironmentWidget::environmentCurrentIndexChanged);
|
||||||
|
|
||||||
connect(d->m_terminalButton, &QAbstractButton::clicked,
|
connect(d->m_terminalButton, &QAbstractButton::clicked,
|
||||||
this, &EnvironmentWidget::openTerminal);
|
this, &EnvironmentWidget::openTerminal);
|
||||||
|
|
||||||
connect(d->m_detailsContainer, &Utils::DetailsWidget::linkActivated,
|
connect(d->m_detailsContainer, &Utils::DetailsWidget::linkActivated,
|
||||||
this, &EnvironmentWidget::linkActivated);
|
this, &EnvironmentWidget::linkActivated);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user