ctkCoordinatesWidget.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) 2010 Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.commontk.org/LICENSE
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkCoordinatesWidget_h
  15. #define __ctkCoordinatesWidget_h
  16. // Qt includes
  17. #include <QWidget>
  18. // CTK includes
  19. #include "CTKWidgetsExport.h"
  20. class CTK_WIDGETS_EXPORT ctkCoordinatesWidget : public QWidget
  21. {
  22. Q_OBJECT
  23. Q_PROPERTY(int Dimension READ dimension WRITE setDimension)
  24. Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
  25. Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
  26. Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep STORED false)
  27. Q_PROPERTY(QString coordinates READ coordinatesAsString WRITE setCoordinatesAsString)
  28. public:
  29. explicit ctkCoordinatesWidget(QWidget* parent = 0);
  30. virtual ~ctkCoordinatesWidget();
  31. ///
  32. /// Set/Get the dimension of the point (3D by default)
  33. void setDimension(int dim);
  34. int dimension() const;
  35. ///
  36. /// Set/Get the single step of the QDoubleSpinBoxes
  37. void setSingleStep(double step);
  38. double singleStep() const;
  39. ///
  40. /// Set/Get the minimum value of the QDoubleSpinBoxes
  41. void setMinimum(double minimum);
  42. double minimum() const;
  43. ///
  44. /// Set/Get the maximum value of the QDoubleSpinBoxes
  45. void setMaximum(double minimum);
  46. double maximum() const;
  47. ///
  48. /// Set/Get the coordinates. Use commas between numbers
  49. void setCoordinatesAsString(QString pos);
  50. QString coordinatesAsString()const;
  51. ///
  52. /// Set/Get the coordinates
  53. void setCoordinates(double* pos);
  54. double* coordinates()const;
  55. signals:
  56. void valueChanged(double* pos);
  57. protected slots:
  58. void coordinateChanged(double);
  59. void coordinatesChanged();
  60. protected:
  61. void AddSpinBox();
  62. double Minimum;
  63. double Maximum;
  64. double SingleStep;
  65. int Dimension;
  66. double* Coordinates;
  67. };
  68. #endif