- enhancement: open the corresponding source file from problem's context menu
This commit is contained in:
parent
d51f60b40b
commit
1cc36564de
1
NEWS.md
1
NEWS.md
|
@ -2,6 +2,7 @@ Red Panda C++ Version 0.12.6
|
|||
- fix: heartbeat for gdb server async command shouldn't disable actions
|
||||
- fix: problem cases doesn't use svg icons
|
||||
- fix: problem's title info not updated after running cases
|
||||
- enhancement: open the corresponding source file from problem's context menu
|
||||
|
||||
Red Panda C++ Version 0.12.5
|
||||
- fix: compile error in linux
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -2113,6 +2113,25 @@ void MainWindow::buildContextMenus()
|
|||
}
|
||||
}
|
||||
});
|
||||
mProblem_OpenSource=createActionFor(
|
||||
tr("Open Source File"),
|
||||
ui->lstProblemSet
|
||||
);
|
||||
connect(mProblem_OpenSource, &QAction::triggered,
|
||||
[this]() {
|
||||
QModelIndex idx = ui->lstProblemSet->currentIndex();
|
||||
if (!idx.isValid())
|
||||
return;
|
||||
POJProblem problem=mOJProblemSetModel.problem(idx.row());
|
||||
if (!problem)
|
||||
return;
|
||||
if (!problem->answerProgram.isEmpty()) {
|
||||
Editor * editor = editorList()->getEditorByFilename(problem->answerProgram);
|
||||
if (editor) {
|
||||
editor->activate();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//context menu signal for the Problem Set lable
|
||||
ui->lblProblemSet->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
@ -2996,7 +3015,9 @@ void MainWindow::onLstProblemSetContextMenu(const QPoint &pos)
|
|||
});
|
||||
menuSetAnswer->addAction(action);
|
||||
menu.addMenu(menuSetAnswer);
|
||||
mProblem_OpenSource->setEnabled(!problem->answerProgram.isEmpty());
|
||||
}
|
||||
menu.addAction(mProblem_OpenSource);
|
||||
menu.addAction(mProblem_Properties);
|
||||
menu.exec(ui->lstProblemSet->mapToGlobal(pos));
|
||||
}
|
||||
|
|
|
@ -668,6 +668,7 @@ private:
|
|||
QAction * mBookmark_Modify;
|
||||
|
||||
//action for problem set
|
||||
QAction * mProblem_OpenSource;
|
||||
QAction * mProblem_Properties;
|
||||
|
||||
// QWidget interface
|
||||
|
|
Loading…
Reference in New Issue