fix: compile buttons not correctly disabled when no file opening.
This commit is contained in:
parent
07f6b975f1
commit
68f4dcec3f
|
@ -658,8 +658,10 @@ void MainWindow::updateCompileActions()
|
|||
} else {
|
||||
bool forProject=false;
|
||||
bool canRun = false;
|
||||
bool canCompile = false;
|
||||
Editor * e = mEditorList->getEditor();
|
||||
if (e) {
|
||||
canCompile = true;
|
||||
if (!e->inProject()) {
|
||||
FileType fileType = getFileType(e->filename());
|
||||
if (fileType == FileType::CSource
|
||||
|
@ -673,13 +675,14 @@ void MainWindow::updateCompileActions()
|
|||
forProject = (mProject!=nullptr);
|
||||
}
|
||||
if (forProject) {
|
||||
canCompile = true;
|
||||
canRun = (mProject->options().type !=ProjectType::DynamicLib)
|
||||
&& (mProject->options().type !=ProjectType::StaticLib);
|
||||
}
|
||||
ui->actionCompile->setEnabled(true);
|
||||
ui->actionCompile_Run->setEnabled(canRun);
|
||||
ui->actionCompile->setEnabled(canCompile);
|
||||
ui->actionCompile_Run->setEnabled(canRun && canCompile);
|
||||
ui->actionRun->setEnabled(canRun);
|
||||
ui->actionRebuild->setEnabled(true);
|
||||
ui->actionRebuild->setEnabled(canCompile);
|
||||
ui->actionGenerate_Assembly->setEnabled(!forProject);
|
||||
ui->actionDebug->setEnabled(canRun);
|
||||
ui->btnRunAllProblemCases->setEnabled(canRun);
|
||||
|
|
|
@ -892,7 +892,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::MultiSelection</enum>
|
||||
<enum>QAbstractItemView::ContiguousSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
|
|
|
@ -18,7 +18,11 @@
|
|||
|
||||
#include <QUuid>
|
||||
|
||||
OJProblemCase::OJProblemCase()
|
||||
OJProblemCase::OJProblemCase():
|
||||
testState(ProblemCaseTestState::NotTested),
|
||||
firstDiffLine(-1),
|
||||
outputLineCounts(0),
|
||||
expectedLineCounts(0)
|
||||
{
|
||||
QUuid uid = QUuid::createUuid();
|
||||
id = uid.toString();
|
||||
|
|
Loading…
Reference in New Issue