1 /************************************************************************
2  **
3  **  @file   vpropertyformwidget_p.h
4  **  @author hedgeware <internal(at)hedgeware.net>
5  **  @date
6  **
7  **  @brief
8  **  @copyright
9  **  All rights reserved. This program and the accompanying materials
10  **  are made available under the terms of the GNU Lesser General Public License
11  **  (LGPL) version 2.1 which accompanies this distribution, and is available at
12  **  http://www.gnu.org/licenses/lgpl-2.1.html
13  **
14  **  This library is distributed in the hope that it will be useful,
15  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  **  Lesser General Public License for more details.
18  **
19  *************************************************************************/
20 
21 #ifndef VPROPERTYFORMWIDGET_P_H
22 #define VPROPERTYFORMWIDGET_P_H
23 
24 // ONLY INCLUDE THIS IN .CPP FILES
25 
26 #include <QList>
27 #include "vproperty.h"
28 #include "../vmisc/diagnostic.h"
29 
30 namespace VPE
31 {
32 
33 QT_WARNING_PUSH
34 QT_WARNING_DISABLE_CLANG("-Wweak-vtables")
35 
36 class VPropertyFormWidgetPrivate
37 {
38 public:
39     //! Stores either another VPropertyFormWidget (then Editor is null) or an editor widget (then FormWidget is null)
40     struct SEditorWidget
41     {
SEditorWidgetSEditorWidget42         SEditorWidget() : FormWidget(nullptr), Editor(nullptr) {}
SEditorWidgetSEditorWidget43         explicit SEditorWidget(VPropertyFormWidget* form_widget) : FormWidget(form_widget), Editor(nullptr) {}
SEditorWidgetSEditorWidget44         explicit SEditorWidget(QWidget* editor_widget) : FormWidget(nullptr), Editor(editor_widget) {}
45 
46         VPropertyFormWidget* FormWidget;
47         QWidget* Editor;
48     };
49 
50     //! The root property to use
51     QList<VProperty*> Properties;
52 
53     //! Binds the properties to their editors
54     QList<SEditorWidget> EditorWidgets;
55 
56     //! Determines the behaviour of the editors. If this is true, when a focus out event etc. happens, the data will be
57     //! submitted to the VProperty. If false, you will have to call commitData() yourself.
58     bool UpdateEditors;
59 
60     //! Default constructor
VPropertyFormWidgetPrivate()61     VPropertyFormWidgetPrivate()
62         : Properties(QList<VProperty*>()), EditorWidgets(QList<SEditorWidget>()), UpdateEditors(true)
63     {}
64 
65     //! Constructor
VPropertyFormWidgetPrivate(const QList<VProperty * > & properties)66     explicit VPropertyFormWidgetPrivate(const QList<VProperty*>& properties)
67         : Properties(properties), EditorWidgets(QList<SEditorWidget>()), UpdateEditors(true)
68     {}
69 
~VPropertyFormWidgetPrivate()70     virtual ~VPropertyFormWidgetPrivate() {}
71 };
72 
73 QT_WARNING_POP
74 
75 }
76 
77 #endif // VPROPERTYFORMWIDGET_P_H
78