Computer Assisted Medical Intervention Tool Kit version 6.0
 
Loading...
Searching...
No Matches
FieldEditor.h
Go to the documentation of this file.
1/*****************************************************************************
2 * $CAMITK_LICENCE_BEGIN$
3 *
4 * CamiTK - Computer Assisted Medical Intervention ToolKit
5 * (c) 2001-2025 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
6 *
7 * Visit http://camitk.imag.fr for more information
8 *
9 * This file is part of CamiTK.
10 *
11 * CamiTK is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * CamiTK is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22 *
23 * $CAMITK_LICENCE_END$
24 ****************************************************************************/
25
26
27#ifndef __FIELD_EDITOR__
28#define __FIELD_EDITOR__
29
30#include <QObject>
31#include <QLabel>
32#include <QWidget>
33
35#include <VariantDataModel.h>
36
51class FieldEditor : public QObject {
52 Q_OBJECT
53public:
59
61 virtual ~FieldEditor();
62
64 virtual QWidget* getWidget() = 0;
65
72 virtual void appendRowTo(QGridLayout* layout, bool canBeDeleted = false);
73
75 void setEnabled(bool isEnabled);
76
77signals:
79 void valueChanged(VariantDataModel& changedDataModel);
80
81protected:
84
87
89 QWidget* myWidget;
90
92 QString name;
93
95 QString description;
96
98 QGridLayout* myGridLayout;
99
102 QLabel* rowLabel;
103
104protected slots:
105
109 virtual void deleteButtonClicked();
110
111};
112
113#endif // __FIELD_EDITOR__
Presenter for a CamiTK extension file model.
Definition CamiTKExtensionModelPresenter.h:47
Abstract class for field editor.
Definition FieldEditor.h:51
QString name
Name of the field (displayed as a label)
Definition FieldEditor.h:92
virtual ~FieldEditor()
Destructor (delete myWidget)
Definition FieldEditor.cpp:43
QString description
Description (displayed as tool tip / what's that)
Definition FieldEditor.h:95
virtual void deleteButtonClicked()
Called when the (optional) delete button is called This will make user the user knows what she/he doe...
Definition FieldEditor.cpp:103
QLabel * rowLabel
the row label widget (that contains the name of the row) the label text can be modified (see CamiTKPr...
Definition FieldEditor.h:102
CamiTKExtensionModelPresenter * presenter
The presenter that contains the full VariantDataModel.
Definition FieldEditor.h:83
QGridLayout * myGridLayout
where the widget is added
Definition FieldEditor.h:98
virtual void appendRowTo(QGridLayout *layout, bool canBeDeleted=false)
Adds a row at the end of the given layout with two columns:
Definition FieldEditor.cpp:48
VariantDataModel & dataModel
The edited data model (part of the presenter's full model)
Definition FieldEditor.h:86
void valueChanged(VariantDataModel &changedDataModel)
emitted when the edited value has changed (useful to synchronize other field editor depending of this...
QWidget * myWidget
The created widget (inheriting must use this to create their widgets)
Definition FieldEditor.h:89
void setEnabled(bool isEnabled)
Is the widget and labels currently enabled.
Definition FieldEditor.cpp:93
virtual QWidget * getWidget()=0
Creates the editor widget (must be implemented in inheriting classes)
VariantDataModel encapsulates QVariant and can be used as a model for any type of QVariant supported ...
Definition VariantDataModel.h:124