MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / openFile

Method openFile

MiniZincIDE/mainwindow.cpp:457–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455}
456
457void MainWindow::openFile(const QString &path, bool openAsModified, bool focus)
458{
459 QStringList fileNames;
460 if (path.isEmpty()) {
461 fileNames = QFileDialog::getOpenFileNames(this, tr("Open File"), getLastPath(), "MiniZinc Files (*.mzn *.dzn *.fzn *.json *.mzp *.mzc *.mpc);;Other (*)");
462 if (!fileNames.isEmpty()) {
463 setLastPath(QFileInfo(fileNames.last()).absolutePath() + fileDialogSuffix);
464 }
465 } else {
466 fileNames << path;
467 }
468
469 for (auto& fileName : fileNames) {
470 if (fileName.endsWith(".mzp")) {
471 openProject(fileName);
472 } else if (fileName.endsWith(".mpc")) {
473 QString absPath = QFileInfo(fileName).canonicalFilePath();
474 if (ui->config_window->addConfig(absPath)) {
475 getProject().add(absPath);
476 ui->configWindow_dockWidget->setVisible(true);
477 }
478 } else {
479 createEditor(fileName, openAsModified, false, false, focus);
480 }
481 }
482
483}
484
485void MainWindow::tabCloseRequest(int tab)
486{

Callers

nothing calls this directly

Calls 2

addConfigMethod · 0.80
addMethod · 0.80

Tested by

no test coverage detected