- enhancement: Remove multiple problems in the problem set view

- enhancement: Clear the proble view after a new problem set created
This commit is contained in:
Roy Qu 2022-12-15 16:33:17 +08:00
parent 47e40d2f8e
commit 4985191120
3 changed files with 21 additions and 4 deletions

View File

@ -1,3 +1,8 @@
Red Panda C++ Version 2.7
- enhancement: Remove multiple problems in the problem set view
- enhancement: Clear the proble view after a new problem set created
Red Panda C++ Version 2.6
- enhancement: Highlighter for makefiles

View File

@ -7789,6 +7789,7 @@ void MainWindow::on_btnNewProblemSet_clicked()
mOJProblemSetNameCounter++;
mOJProblemSetModel.create(tr("Problem Set %1").arg(mOJProblemSetNameCounter));
ui->lblProblemSet->setText(mOJProblemSetModel.name());
onProblemSetIndexChanged(QModelIndex(),QModelIndex());
}
@ -7810,10 +7811,18 @@ void MainWindow::on_btnAddProblem_clicked()
void MainWindow::on_btnRemoveProblem_clicked()
{
QModelIndex idx = ui->lstProblemSet->currentIndex();
if (!idx.isValid())
return;
mOJProblemSetModel.removeProblem(idx.row());
QList<int> idxList;
foreach (const QModelIndex idx,ui->lstProblemSet->selectionModel()->selectedIndexes()) {
idxList.append(idx.row());
}
std::sort(idxList.begin(),idxList.end(),[](int i1, int i2){
return i1>i2;
});
qDebug()<<idxList;
foreach (int id,idxList) {
mOJProblemSetModel.removeProblem(id);
}
}

View File

@ -879,6 +879,9 @@
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>