ctkCoordinatesWidget.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. All rights reserved.
  5. Distributed under a BSD License. See LICENSE.txt file.
  6. This software is distributed "AS IS" WITHOUT ANY WARRANTY; without even
  7. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the above copyright notice for more information.
  9. =========================================================================*/
  10. #ifndef __ctkCoordinatesWidget_h
  11. #define __ctkCoordinatesWidget_h
  12. // Qt includes
  13. #include <QWidget>
  14. // CTK includes
  15. #include "CTKWidgetsExport.h"
  16. class CTK_WIDGETS_EXPORT ctkCoordinatesWidget : public QWidget
  17. {
  18. Q_OBJECT
  19. Q_PROPERTY(int Dimension READ dimension WRITE setDimension)
  20. Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
  21. Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
  22. Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep STORED false)
  23. Q_PROPERTY(QString coordinates READ coordinatesAsString WRITE setCoordinatesAsString)
  24. public:
  25. explicit ctkCoordinatesWidget(QWidget* parent = 0);
  26. virtual ~ctkCoordinatesWidget();
  27. ///
  28. /// Set/Get the dimension of the point (3D by default)
  29. void setDimension(int dim);
  30. int dimension() const;
  31. ///
  32. /// Set/Get the single step of the QDoubleSpinBoxes
  33. void setSingleStep(double step);
  34. double singleStep() const;
  35. ///
  36. /// Set/Get the minimum value of the QDoubleSpinBoxes
  37. void setMinimum(double minimum);
  38. double minimum() const;
  39. ///
  40. /// Set/Get the maximum value of the QDoubleSpinBoxes
  41. void setMaximum(double minimum);
  42. double maximum() const;
  43. ///
  44. /// Set/Get the coordinates. Use commas between numbers
  45. void setCoordinatesAsString(QString pos);
  46. QString coordinatesAsString()const;
  47. ///
  48. /// Set/Get the coordinates
  49. void setCoordinates(double* pos);
  50. double* coordinates()const;
  51. signals:
  52. void valueChanged(double* pos);
  53. protected slots:
  54. void coordinateChanged(double);
  55. void coordinatesChanged();
  56. protected:
  57. void AddSpinBox();
  58. double Minimum;
  59. double Maximum;
  60. double SingleStep;
  61. int Dimension;
  62. double* Coordinates;
  63. };
  64. #endif