QProcess: mark obsolete functions as deprecated
QProcess::finished(int)/readChannelMode()/setReadChannelMode() are obsolete but were not marked as deprecated. Explicit mark them as deprecated so they can be removed with Qt6. Change-Id: Iedbfd80a3c987f35caf93181e9277913a18961d9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
7bebdb472a
commit
5eab68bbee
@ -813,6 +813,7 @@ void QProcessPrivate::Channel::clear()
|
||||
\a newState argument is the state QProcess changed to.
|
||||
*/
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\fn void QProcess::finished(int exitCode)
|
||||
\obsolete
|
||||
@ -820,6 +821,7 @@ void QProcessPrivate::Channel::clear()
|
||||
|
||||
Use finished(int exitCode, QProcess::ExitStatus status) instead.
|
||||
*/
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn void QProcess::finished(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
@ -1172,7 +1174,9 @@ bool QProcessPrivate::_q_processDied()
|
||||
//emit q->standardOutputClosed();
|
||||
//emit q->standardErrorClosed();
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
emit q->finished(exitCode);
|
||||
#endif
|
||||
emit q->finished(exitCode, exitStatus);
|
||||
}
|
||||
#if defined QPROCESS_DEBUG
|
||||
@ -1264,6 +1268,7 @@ QProcess::~QProcess()
|
||||
d->cleanup();
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\obsolete
|
||||
Returns the read channel mode of the QProcess. This function is
|
||||
@ -1287,6 +1292,7 @@ void QProcess::setReadChannelMode(ProcessChannelMode mode)
|
||||
{
|
||||
setProcessChannelMode(mode);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\since 4.2
|
||||
@ -2473,7 +2479,7 @@ QProcess::ExitStatus QProcess::exitStatus() const
|
||||
int QProcess::execute(const QString &program, const QStringList &arguments)
|
||||
{
|
||||
QProcess process;
|
||||
process.setReadChannelMode(ForwardedChannels);
|
||||
process.setProcessChannelMode(ForwardedChannels);
|
||||
process.start(program, arguments);
|
||||
if (!process.waitForFinished(-1) || process.error() == FailedToStart)
|
||||
return -2;
|
||||
@ -2496,7 +2502,7 @@ int QProcess::execute(const QString &program, const QStringList &arguments)
|
||||
int QProcess::execute(const QString &command)
|
||||
{
|
||||
QProcess process;
|
||||
process.setReadChannelMode(ForwardedChannels);
|
||||
process.setProcessChannelMode(ForwardedChannels);
|
||||
process.start(command);
|
||||
if (!process.waitForFinished(-1) || process.error() == FailedToStart)
|
||||
return -2;
|
||||
|
@ -172,8 +172,12 @@ public:
|
||||
QStringList arguments() const;
|
||||
void setArguments(const QStringList & arguments);
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use QProcess::processChannelMode() instead")
|
||||
ProcessChannelMode readChannelMode() const;
|
||||
QT_DEPRECATED_X("Use QProcess::setProcessChannelMode() instead")
|
||||
void setReadChannelMode(ProcessChannelMode mode);
|
||||
#endif
|
||||
ProcessChannelMode processChannelMode() const;
|
||||
void setProcessChannelMode(ProcessChannelMode mode);
|
||||
InputChannelMode inputChannelMode() const;
|
||||
@ -269,7 +273,10 @@ public Q_SLOTS:
|
||||
|
||||
Q_SIGNALS:
|
||||
void started(QPrivateSignal);
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use QProcess::finished(int, QProcess::ExitStatus) instead")
|
||||
void finished(int exitCode); // ### Qt 6: merge the two signals with a default value
|
||||
#endif
|
||||
void finished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
#if QT_DEPRECATED_SINCE(5,6)
|
||||
void error(QProcess::ProcessError error);
|
||||
|
@ -185,12 +185,12 @@ void tst_QProcess::getSetCheck()
|
||||
{
|
||||
QProcess obj1;
|
||||
// ProcessChannelMode QProcess::readChannelMode()
|
||||
// void QProcess::setReadChannelMode(ProcessChannelMode)
|
||||
obj1.setReadChannelMode(QProcess::ProcessChannelMode(QProcess::SeparateChannels));
|
||||
// void QProcess::setProcessChannelMode(ProcessChannelMode)
|
||||
obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::SeparateChannels));
|
||||
QCOMPARE(QProcess::ProcessChannelMode(QProcess::SeparateChannels), obj1.readChannelMode());
|
||||
obj1.setReadChannelMode(QProcess::ProcessChannelMode(QProcess::MergedChannels));
|
||||
obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::MergedChannels));
|
||||
QCOMPARE(QProcess::ProcessChannelMode(QProcess::MergedChannels), obj1.readChannelMode());
|
||||
obj1.setReadChannelMode(QProcess::ProcessChannelMode(QProcess::ForwardedChannels));
|
||||
obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::ForwardedChannels));
|
||||
QCOMPARE(QProcess::ProcessChannelMode(QProcess::ForwardedChannels), obj1.readChannelMode());
|
||||
|
||||
// ProcessChannel QProcess::readChannel()
|
||||
@ -913,7 +913,7 @@ public:
|
||||
|
||||
switch (n) {
|
||||
case 0:
|
||||
setReadChannelMode(QProcess::MergedChannels);
|
||||
setProcessChannelMode(QProcess::MergedChannels);
|
||||
connect(this, &QIODevice::readyRead, this, &SoftExitProcess::terminateSlot);
|
||||
break;
|
||||
case 1:
|
||||
@ -929,7 +929,7 @@ public:
|
||||
this, &SoftExitProcess::terminateSlot);
|
||||
break;
|
||||
case 4:
|
||||
setReadChannelMode(QProcess::MergedChannels);
|
||||
setProcessChannelMode(QProcess::MergedChannels);
|
||||
connect(this, SIGNAL(channelReadyRead(int)), this, SLOT(terminateSlot()));
|
||||
break;
|
||||
default:
|
||||
@ -1025,7 +1025,7 @@ void tst_QProcess::softExitInSlots()
|
||||
void tst_QProcess::mergedChannels()
|
||||
{
|
||||
QProcess process;
|
||||
process.setReadChannelMode(QProcess::MergedChannels);
|
||||
process.setProcessChannelMode(QProcess::MergedChannels);
|
||||
QCOMPARE(process.readChannelMode(), QProcess::MergedChannels);
|
||||
|
||||
process.start("testProcessEcho2/testProcessEcho2");
|
||||
@ -1951,7 +1951,7 @@ void tst_QProcess::setStandardOutputFile()
|
||||
|
||||
// run the process
|
||||
QProcess process;
|
||||
process.setReadChannelMode(channelMode);
|
||||
process.setProcessChannelMode(channelMode);
|
||||
if (channelToTest == QProcess::StandardOutput)
|
||||
process.setStandardOutputFile(file.fileName(), mode);
|
||||
else
|
||||
@ -2037,7 +2037,7 @@ void tst_QProcess::setStandardOutputProcess()
|
||||
|
||||
QFETCH(bool, merged);
|
||||
QFETCH(bool, waitForBytesWritten);
|
||||
source.setReadChannelMode(merged ? QProcess::MergedChannels : QProcess::SeparateChannels);
|
||||
source.setProcessChannelMode(merged ? QProcess::MergedChannels : QProcess::SeparateChannels);
|
||||
source.setStandardOutputProcess(&sink);
|
||||
|
||||
source.start("testProcessEcho2/testProcessEcho2");
|
||||
|
@ -215,7 +215,7 @@ static bool runHelper(const QString &program, const QStringList &arguments, QByt
|
||||
{
|
||||
#if QT_CONFIG(process)
|
||||
QProcess process;
|
||||
process.setReadChannelMode(QProcess::ForwardedChannels);
|
||||
process.setProcessChannelMode(QProcess::ForwardedChannels);
|
||||
process.start(program, arguments);
|
||||
if (!process.waitForStarted()) {
|
||||
*errorMessage = "Unable to start '" + program.toLocal8Bit() + " ': "
|
||||
|
Loading…
x
Reference in New Issue
Block a user