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

Method event

MiniZincIDE/ide.cpp:66–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64};
65
66bool IDE::event(QEvent *e)
67{
68 switch (e->type()) {
69 case QEvent::FileOpen:
70 {
71 QString file = static_cast<QFileOpenEvent*>(e)->file();
72 if (file.endsWith(".mzp")) {
73 PMap::iterator it = projects.find(file);
74 if (it==projects.end()) {
75 MainWindow* mw = qobject_cast<MainWindow*>(activeWindow());
76 if (mw==nullptr) {
77 mw = new MainWindow(file);
78 mw->show();
79 } else {
80 mw->openProject(file);
81 }
82 } else {
83 it.value()->raise();
84 it.value()->activateWindow();
85 }
86 } else {
87 MainWindow* curw = qobject_cast<MainWindow*>(activeWindow());
88 if (curw != nullptr && (curw->isEmptyProject() || curw==lastDefaultProject)) {
89 curw->openFile(file);
90 lastDefaultProject = curw;
91 } else {
92 QStringList files;
93 files << file;
94 MainWindow* mw = new MainWindow(files);
95 if (curw!=nullptr) {
96 QPoint p = curw->pos();
97 mw->move(p.x()+20, p.y()+20);
98 }
99 mw->show();
100 lastDefaultProject = mw;
101 }
102 }
103 return true;
104 }
105 default:
106 return QApplication::event(e);
107 }
108}
109
110void IDE::checkUpdate(void) {
111 QSettings settings;

Callers

nothing calls this directly

Calls 8

typeMethod · 0.80
findMethod · 0.80
openProjectMethod · 0.80
isEmptyProjectMethod · 0.80
endMethod · 0.45
raiseMethod · 0.45
valueMethod · 0.45
openFileMethod · 0.45

Tested by

no test coverage detected