Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
QmitkFileReaderWriterOptionsWidget.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkFileReaderWriterOptionsWidget_h
14 #define QmitkFileReaderWriterOptionsWidget_h
15 
16 #include <QCheckBox>
17 #include <QComboBox>
18 #include <QDoubleSpinBox>
19 #include <QLabel>
20 #include <QLineEdit>
21 #include <QSpinBox>
22 #include <QWidget>
23 
24 #include <usAny.h>
25 
27 {
28  QmitkAnyAdapter(const std::string &name) : m_Name(name) {}
29  virtual ~QmitkAnyAdapter() {}
30  virtual us::Any GetAny() const = 0;
31  std::string GetName() const { return m_Name; }
32 private:
33  std::string m_Name;
34 };
35 
36 class QmitkAnyStringWidget : public QLineEdit, public QmitkAnyAdapter
37 {
38  Q_OBJECT
39 
40 public:
41  QmitkAnyStringWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
42  us::Any GetAny() const override;
43 };
44 
45 class QmitkAnyVectorWidget : public QComboBox, public QmitkAnyAdapter
46 {
47  Q_OBJECT
48 
49 public:
50  QmitkAnyVectorWidget(const std::string &name,
51  const us::Any &any,
52  const QString &defaultValue,
53  QWidget *parent = nullptr);
54  us::Any GetAny() const override;
55 };
56 
57 class QmitkAnyBoolWidget : public QCheckBox, public QmitkAnyAdapter
58 {
59  Q_OBJECT
60 
61 public:
62  QmitkAnyBoolWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
63  us::Any GetAny() const override;
64 };
65 
66 class QmitkAnyShortWidget : public QSpinBox, public QmitkAnyAdapter
67 {
68  Q_OBJECT
69 
70 public:
71  QmitkAnyShortWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
72  us::Any GetAny() const override;
73 };
74 
75 class QmitkAnyUShortWidget : public QSpinBox, public QmitkAnyAdapter
76 {
77  Q_OBJECT
78 
79 public:
80  QmitkAnyUShortWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
81  us::Any GetAny() const override;
82 };
83 
84 class QmitkAnyIntWidget : public QSpinBox, public QmitkAnyAdapter
85 {
86  Q_OBJECT
87 
88 public:
89  QmitkAnyIntWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
90  us::Any GetAny() const override;
91 };
92 
93 class QmitkAnyUIntWidget : public QSpinBox, public QmitkAnyAdapter
94 {
95  Q_OBJECT
96 
97 public:
98  QmitkAnyUIntWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
99  us::Any GetAny() const override;
100 };
101 
102 class QmitkAnyFloatWidget : public QDoubleSpinBox, public QmitkAnyAdapter
103 {
104  Q_OBJECT
105 
106 public:
107  QmitkAnyFloatWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
108  us::Any GetAny() const override;
109 };
110 
111 class QmitkAnyDoubleWidget : public QDoubleSpinBox, public QmitkAnyAdapter
112 {
113  Q_OBJECT
114 
115 public:
116  QmitkAnyDoubleWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
117  us::Any GetAny() const override;
118 };
119 
120 class QmitkInvalidAnyWidget : public QLabel, public QmitkAnyAdapter
121 {
122  Q_OBJECT
123 
124 public:
125  QmitkInvalidAnyWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
126  us::Any GetAny() const override;
127 };
128 
130 {
131  Q_OBJECT
132 
133 public:
134  typedef std::map<std::string, us::Any> Options;
135 
136  QmitkFileReaderWriterOptionsWidget(const Options &options, QWidget *parent = nullptr);
137 
138  Options GetOptions() const;
139 
140 private:
141  Q_DISABLE_COPY(QmitkFileReaderWriterOptionsWidget)
142 };
143 
144 #endif
QmitkAnyIntWidget::GetAny
us::Any GetAny() const override
QmitkAnyFloatWidget
Definition: QmitkFileReaderWriterOptionsWidget.h:102
QmitkAnyAdapter::QmitkAnyAdapter
QmitkAnyAdapter(const std::string &name)
Definition: QmitkFileReaderWriterOptionsWidget.h:28
usAny.h
QmitkAnyAdapter::~QmitkAnyAdapter
virtual ~QmitkAnyAdapter()
Definition: QmitkFileReaderWriterOptionsWidget.h:29
QmitkFileReaderWriterOptionsWidget::GetOptions
Options GetOptions() const
QmitkAnyBoolWidget::QmitkAnyBoolWidget
QmitkAnyBoolWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkAnyAdapter::GetName
std::string GetName() const
Definition: QmitkFileReaderWriterOptionsWidget.h:31
QmitkAnyStringWidget
Definition: QmitkFileReaderWriterOptionsWidget.h:36
QmitkAnyStringWidget::QmitkAnyStringWidget
QmitkAnyStringWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkAnyBoolWidget
Definition: QmitkFileReaderWriterOptionsWidget.h:57
QmitkAnyDoubleWidget::GetAny
us::Any GetAny() const override
QmitkAnyUShortWidget
Definition: QmitkFileReaderWriterOptionsWidget.h:75
QmitkAnyIntWidget::QmitkAnyIntWidget
QmitkAnyIntWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkAnyVectorWidget::GetAny
us::Any GetAny() const override
QmitkAnyVectorWidget::QmitkAnyVectorWidget
QmitkAnyVectorWidget(const std::string &name, const us::Any &any, const QString &defaultValue, QWidget *parent=nullptr)
QmitkFileReaderWriterOptionsWidget
Definition: QmitkFileReaderWriterOptionsWidget.h:129
QmitkAnyFloatWidget::QmitkAnyFloatWidget
QmitkAnyFloatWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkAnyUIntWidget::QmitkAnyUIntWidget
QmitkAnyUIntWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkAnyStringWidget::GetAny
us::Any GetAny() const override
us::Any
Definition: usAny.h:163
QmitkAnyBoolWidget::GetAny
us::Any GetAny() const override
QmitkAnyDoubleWidget::QmitkAnyDoubleWidget
QmitkAnyDoubleWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkInvalidAnyWidget
Definition: QmitkFileReaderWriterOptionsWidget.h:120
QmitkInvalidAnyWidget::QmitkInvalidAnyWidget
QmitkInvalidAnyWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkAnyShortWidget
Definition: QmitkFileReaderWriterOptionsWidget.h:66
QmitkAnyUShortWidget::QmitkAnyUShortWidget
QmitkAnyUShortWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkAnyUIntWidget::GetAny
us::Any GetAny() const override
QmitkAnyIntWidget
Definition: QmitkFileReaderWriterOptionsWidget.h:84
QmitkAnyVectorWidget
Definition: QmitkFileReaderWriterOptionsWidget.h:45
QmitkAnyShortWidget::GetAny
us::Any GetAny() const override
QmitkAnyShortWidget::QmitkAnyShortWidget
QmitkAnyShortWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkAnyUIntWidget
Definition: QmitkFileReaderWriterOptionsWidget.h:93
QmitkAnyUShortWidget::GetAny
us::Any GetAny() const override
QmitkAnyAdapter::GetAny
virtual us::Any GetAny() const =0
QmitkFileReaderWriterOptionsWidget::Options
std::map< std::string, us::Any > Options
Definition: QmitkFileReaderWriterOptionsWidget.h:134
QmitkAnyAdapter
Definition: QmitkFileReaderWriterOptionsWidget.h:26
QmitkAnyFloatWidget::GetAny
us::Any GetAny() const override
QmitkInvalidAnyWidget::GetAny
us::Any GetAny() const override
QmitkFileReaderWriterOptionsWidget::QmitkFileReaderWriterOptionsWidget
QmitkFileReaderWriterOptionsWidget(const Options &options, QWidget *parent=nullptr)
QmitkAnyDoubleWidget
Definition: QmitkFileReaderWriterOptionsWidget.h:111