From 1f1c75cb1ddda6e6a99c441e512177c581239848 Mon Sep 17 00:00:00 2001 From: royqh1979 Date: Sat, 6 Nov 2021 16:22:26 +0800 Subject: [PATCH] - enhancement: right click the problem set name label to rename it --- RedPandaIDE/mainwindow.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index cda29129..e6714139 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1830,6 +1830,23 @@ void MainWindow::buildContextMenus() } }); + //context menu signal for the Problem Set lable + ui->lblProblemSet->setContextMenuPolicy(Qt::CustomContextMenu); + connect(ui->lblProblemSet, &QWidget::customContextMenuRequested, + [this] { + QString newName = QInputDialog::getText( + ui->lblProblemSet, + tr("Set Problem Set Name"), + tr("Problem Set Name:"), + QLineEdit::Normal, + ui->lblProblemSet->text()); + newName = newName.trimmed(); + if (!newName.isEmpty()){ + mOJProblemSetModel.rename(newName); + ui->lblProblemSet->setText(mOJProblemSetModel.name()); + } + }); + //context menu signal for the watch view ui->watchView->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->watchView,&QWidget::customContextMenuRequested,