- fix: when running problem cases, the output textbox might be wrongly cleared.

This commit is contained in:
Roy Qu 2022-02-04 19:14:10 +08:00
parent 79aecde9a5
commit 0099aa436a
3 changed files with 6 additions and 6 deletions

View File

@ -3494,7 +3494,7 @@ Are you really want to continue?</oldsource>
<message>
<location filename="mainwindow.ui" line="1546"/>
<source>Tool Panels</source>
<translation></translation>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="1771"/>
@ -4209,7 +4209,7 @@ Are you really want to continue?</oldsource>
<message>
<location filename="mainwindow.ui" line="2525"/>
<source>Show Tool Panels</source>
<translation></translation>
<translation></translation>
</message>
<message>
<source>Tool Window Bars</source>

View File

@ -117,6 +117,7 @@ void OJProblemCasesRunner::runCase(int index,POJProblemCase problemCase)
}
if (process.state() == QProcess::ProcessState::NotRunning)
buffer += process.readAll();
emit newOutputGetted(problemCase->getId(),QString::fromLocal8Bit(buffer));
output.append(buffer);
if (errorOccurred) {
//qDebug()<<"process error:"<<process.error();

View File

@ -4070,11 +4070,10 @@ void MainWindow::onOJProblemCaseStarted(const QString& id,int current, int total
problemCase->testState = ProblemCaseTestState::Testing;
mOJProblemModel.update(row);
QModelIndex idx = ui->lstProblemCases->currentIndex();
if (idx.isValid()) {
if (row == idx.row()) {
ui->txtProblemCaseOutput->clear();
}
if (!idx.isValid() || row != idx.row()) {
ui->lstProblemCases->setCurrentIndex(mOJProblemModel.index(row,0));
}
ui->txtProblemCaseOutput->clear();
}
}