- 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 Red Panda C++ Version 2.6
- enhancement: Highlighter for makefiles - enhancement: Highlighter for makefiles

View File

@ -7789,6 +7789,7 @@ void MainWindow::on_btnNewProblemSet_clicked()
mOJProblemSetNameCounter++; mOJProblemSetNameCounter++;
mOJProblemSetModel.create(tr("Problem Set %1").arg(mOJProblemSetNameCounter)); mOJProblemSetModel.create(tr("Problem Set %1").arg(mOJProblemSetNameCounter));
ui->lblProblemSet->setText(mOJProblemSetModel.name()); ui->lblProblemSet->setText(mOJProblemSetModel.name());
onProblemSetIndexChanged(QModelIndex(),QModelIndex());
} }
@ -7810,10 +7811,18 @@ void MainWindow::on_btnAddProblem_clicked()
void MainWindow::on_btnRemoveProblem_clicked() void MainWindow::on_btnRemoveProblem_clicked()
{ {
QModelIndex idx = ui->lstProblemSet->currentIndex(); QList<int> idxList;
if (!idx.isValid()) foreach (const QModelIndex idx,ui->lstProblemSet->selectionModel()->selectedIndexes()) {
return; idxList.append(idx.row());
mOJProblemSetModel.removeProblem(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"> <property name="alternatingRowColors">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
<property name="selectionBehavior"> <property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum> <enum>QAbstractItemView::SelectRows</enum>
</property> </property>