- enhancement: right click the problem set name label to rename it

This commit is contained in:
royqh1979 2021-11-06 16:22:26 +08:00
parent a30982ffa5
commit 1f1c75cb1d
1 changed files with 17 additions and 0 deletions

View File

@ -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,