PerfTracePointDialog: Use QtcProcess::setWriteData

There is only one write() after process has started,
so use setWriteData() instead.

Change-Id: I060b79926d9163d96d0bd1380b630191524daa96
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-02-28 11:00:01 +01:00
parent 3cfb242acd
commit 9f367e3498
2 changed files with 2 additions and 10 deletions

View File

@@ -99,6 +99,8 @@ void PerfTracePointDialog::runScript()
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
m_process.reset(m_device->createProcess(this));
m_process->setWriteData(m_ui->textEdit->toPlainText().toUtf8());
m_ui->textEdit->clear();
const QString elevate = m_ui->privilegesChooser->currentText();
if (elevate != QLatin1String("n.a."))
@@ -106,9 +108,6 @@ void PerfTracePointDialog::runScript()
else
m_process->setCommand({"sh", {}});
connect(m_process.get(), &DeviceProcess::started,
this, &PerfTracePointDialog::feedScriptToProcess);
connect(m_process.get(), &DeviceProcess::finished,
this, &PerfTracePointDialog::handleProcessFinished);
@@ -118,12 +117,6 @@ void PerfTracePointDialog::runScript()
m_process->start();
}
void PerfTracePointDialog::feedScriptToProcess()
{
m_process->write(m_ui->textEdit->toPlainText().toUtf8());
m_ui->textEdit->clear();
}
void PerfTracePointDialog::handleProcessFinished()
{
if (m_process->exitCode() != 0) {

View File

@@ -49,7 +49,6 @@ public:
private:
void runScript();
void feedScriptToProcess();
void handleProcessFinished();
void handleProcessError(QProcess::ProcessError error);
void finish();