Qt6: Adapt to removal of QProcess::setupChildProcess

And use QProcess::setChildProcessModifier when compiling against Qt6.

Task-number: QTCREATORBUG-24098
Change-Id: I4166a8e27f8f63dd661df119413cd2eb2ae1dc2e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2020-09-28 16:29:51 +02:00
parent df52de2828
commit 3433b8c24f
5 changed files with 48 additions and 2 deletions

View File

@@ -89,19 +89,37 @@ static Q_LOGGING_CATEGORY(processLog, "qtc.utils.synchronousprocess", QtWarningM
// A special QProcess derivative allowing for terminal control.
class TerminalControllingProcess : public QProcess {
public:
TerminalControllingProcess() = default;
TerminalControllingProcess();
unsigned flags() const { return m_flags; }
void setFlags(unsigned tc) { m_flags = tc; }
protected:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void setupChildProcess() override;
#endif
private:
void setupChildProcess_impl();
unsigned m_flags = 0;
};
TerminalControllingProcess::TerminalControllingProcess()
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && defined(Q_OS_UNIX)
setChildProcessModifier([this] { setupChildProcess_impl(); });
#endif
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void TerminalControllingProcess::setupChildProcess()
{
setupChildProcess_impl();
}
#endif
void TerminalControllingProcess::setupChildProcess_impl()
{
#ifdef Q_OS_UNIX
// Disable terminal by becoming a session leader.