QSS Solver GUI  4.5.3
editor.hpp
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  This file is part of QSS Solver.
4 
5  QSS Solver is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  QSS Solver is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QSS Solver. If not, see <http://www.gnu.org/licenses/>.
17 
18  ******************************************************************************/
19 
20 #pragma once
21 
22 #include <QtGui>
23 
24 #include <modeleditor.hpp>
25 
26 class Editor {
27  public:
28  static ModelEditor* instance(QWidget* parent = nullptr, QString name = QString())
29  {
30  if (!_instance) {
31  _instance = new ModelEditor(parent, name);
32  }
33  return _instance;
34  }
35  static void drop()
36  {
37  if (!_instance) {
38  delete _instance;
39  }
40  _instance = nullptr;
41  }
42 
43  private:
44  Editor() {}
45  Editor(const Editor&); // hide copy constructor
46  Editor& operator=(const Editor&); // hide assign op
47  static ModelEditor* _instance;
48 };
Editor::instance
static ModelEditor * instance(QWidget *parent=nullptr, QString name=QString())
Definition: editor.hpp:45
modeleditor.hpp
Editor::drop
static void drop()
Definition: editor.hpp:52
ModelEditor
Definition: modeleditor.hpp:31
Editor::_instance
static ModelEditor * _instance
Definition: editor.hpp:64
Editor::operator=
Editor & operator=(const Editor &)
Editor::Editor
Editor()
Definition: editor.hpp:61
Editor
Definition: editor.hpp:26