CTK 0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Loading...
Searching...
No Matches
ctkCoordinatesWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Library: CTK
4
5 Copyright (c) Kitware Inc.
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0.txt
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18
19=========================================================================*/
20
21#ifndef __ctkCoordinatesWidget_h
22#define __ctkCoordinatesWidget_h
23
24// Qt includes
25#include <QWidget>
26
27// CTK includes
28#include "ctkDoubleSpinBox.h"
29#include "ctkWidgetsExport.h"
30class ctkCoordinatesWidgetPrivate;
31
38class CTK_WIDGETS_EXPORT ctkCoordinatesWidget : public QWidget
39{
40 Q_OBJECT
41
42 Q_PROPERTY(int dimension READ dimension WRITE setDimension)
46 Q_PROPERTY(bool normalized READ isNormalized WRITE setNormalized)
47
52 Q_PROPERTY(int decimals READ decimals WRITE setDecimals)
55 Q_PROPERTY(ctkDoubleSpinBox::DecimalsOptions decimalsOption READ decimalsOption WRITE setDecimalsOption)
56
57 Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep STORED false)
61 Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
65 Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
66
67 Q_PROPERTY(QString coordinates READ coordinatesAsString WRITE setCoordinatesAsString)
68
72 Q_PROPERTY(ctkDoubleSpinBox::SizeHintPolicy sizeHintPolicy READ sizeHintPolicy WRITE setSizeHintPolicy)
73
74public:
75 explicit ctkCoordinatesWidget(QWidget* parent = 0);
77
80 void setDimension(int dim);
81 int dimension() const;
82
85 int decimals() const;
86
89 ctkDoubleSpinBox::DecimalsOptions decimalsOption()const;
92 void setDecimalsOption(ctkDoubleSpinBox::DecimalsOptions option);
93
96 void setSingleStep(double step);
97 double singleStep() const;
98
101 void setMinimum(double minimum);
102 double minimum() const;
103
106 void setMaximum(double minimum);
107 double maximum() const;
108
111 void setRange(double minimum, double maximum);
112
116 void setNormalized(bool normalize);
117 bool isNormalized()const;
118
120 double norm()const;
122 double squaredNorm()const;
123
126 void setCoordinatesAsString(QString pos);
127 QString coordinatesAsString()const;
128
131 void setCoordinates(double* pos);
132 double const * coordinates()const;
133
135 void setCoordinates(double x, double y = 0., double z = 0., double w = 0.);
136
139 void setSizeHintPolicy(ctkDoubleSpinBox::SizeHintPolicy newSizeHintPolicy);
142 ctkDoubleSpinBox::SizeHintPolicy sizeHintPolicy()const;
143
146 void setValueProxy(ctkValueProxy* proxy);
147 ctkValueProxy* valueProxy() const;
148
150 ctkDoubleSpinBox* spinBox(int id);
151public Q_SLOTS:
152 void normalize();
153
155 void setDecimals(int decimals);
156
157Q_SIGNALS:
162 void coordinatesChanged(double* pos);
163
164protected Q_SLOTS:
165 void updateCoordinates();
166 void updateCoordinate(double coordinate);
167
168protected:
169 QScopedPointer<ctkCoordinatesWidgetPrivate> d_ptr;
170
171private:
172 Q_DECLARE_PRIVATE(ctkCoordinatesWidget);
173 Q_DISABLE_COPY(ctkCoordinatesWidget);
174};
175
176#endif
Custom SpinBox The ctkDoubleSpinBox internaly uses a QDoubleSpinBox while it retain controls over it.
Base class for value proxies. Value proxy allows to decouple the displayed value from the values acce...