From 4985191120fe7b9d806466ae815c4690d41fb4fe Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Thu, 15 Dec 2022 16:33:17 +0800 Subject: [PATCH] - enhancement: Remove multiple problems in the problem set view - enhancement: Clear the proble view after a new problem set created --- NEWS.md | 5 +++++ RedPandaIDE/mainwindow.cpp | 17 +++++++++++++---- RedPandaIDE/mainwindow.ui | 3 +++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index aa2ac379..c80e4724 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 0cd20ea2..5df33cd2 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -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 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()< true + + QAbstractItemView::MultiSelection + QAbstractItemView::SelectRows