labplot  2.8.2
About: LabPlot is an application for plotting and analysis of 2D and 3D functions and data. It is a complete rewrite of LabPlot1 and lacks in the first release a lot of features available in the predecessor. On the other hand, the GUI and the usability is more superior.
  Fossies Dox: labplot-2.8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

BaseDock.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : BaseDock.h
3  Project : LabPlot
4  Description : Base dock widget
5  --------------------------------------------------------------------
6  Copyright : (C) 2019 Martin Marmsoler (martin.marmsoler@gmail.com)
7  Copyright : (C) 2019-2020 Alexander Semke (alexander.semke@web.de)
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 
30 #ifndef BASEDOCK
31 #define BASEDOCK
32 
34 
35 #include <QWidget>
36 #include <QLineEdit>
37 
38 class AbstractAspect;
39 
40 struct Lock {
41  inline explicit Lock(bool& variable)
42  : variable(variable = true) {
43  }
44 
45  inline ~Lock() {
46  variable = false;
47  }
48 
49 private:
50  bool& variable;
51 };
52 
53 
54 class BaseDock : public QWidget {
55  Q_OBJECT
56 
57 public:
58  explicit BaseDock(QWidget* parent);
60 
61  enum class Units {Metric, Imperial};
62 
63  virtual void updateLocale() {};
64  virtual void updateUnits() {};
65 
66 protected:
67  bool m_initializing{false};
68  QLineEdit* m_leName{nullptr};
69  QLineEdit* m_leComment{nullptr};
74 
75 protected slots:
76  void nameChanged();
77  void commentChanged();
78 };
79 
80 #endif
Base class of all persistent objects in a Project.
Worksheet::Unit m_worksheetUnit
Definition: BaseDock.h:73
QList< AbstractAspect * > m_aspects
Definition: BaseDock.h:71
virtual void updateUnits()
Definition: BaseDock.h:64
QLineEdit * m_leName
Definition: BaseDock.h:68
BaseDock(QWidget *parent)
Definition: BaseDock.cpp:37
QLineEdit * m_leComment
Definition: BaseDock.h:69
void commentChanged()
Definition: BaseDock.cpp:61
AbstractAspect * m_aspect
Definition: BaseDock.h:70
bool m_initializing
Definition: BaseDock.h:67
void nameChanged()
Definition: BaseDock.cpp:47
Units m_units
Definition: BaseDock.h:72
virtual void updateLocale()
Definition: BaseDock.h:63
Definition: BaseDock.h:40
bool & variable
Definition: BaseDock.h:50
Lock(bool &variable)
Definition: BaseDock.h:41
~Lock()
Definition: BaseDock.h:45