ctkMatrixWidget.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 __ctkMatrixWidget_h
  11. #define __ctkMatrixWidget_h
  12. /// Qt includes
  13. #include <QTableWidget>
  14. /// CTK includes
  15. #include "ctkPimpl.h"
  16. #include "CTKWidgetsExport.h"
  17. class ctkMatrixWidgetPrivate;
  18. class CTK_WIDGETS_EXPORT ctkMatrixWidget : public QTableWidget
  19. {
  20. Q_OBJECT
  21. public:
  22. /// Superclass typedef
  23. typedef QTableWidget Superclass;
  24. /// Constructors
  25. explicit ctkMatrixWidget(QWidget* parent = 0);
  26. virtual ~ctkMatrixWidget(){}
  27. ///
  28. /// Set / Get values
  29. double value(int i, int j);
  30. void setValue(int i, int j, double value);
  31. void setVector(const QVector<double> & vector);
  32. ///
  33. /// Overloaded - See QWidget
  34. virtual QSize minimumSizeHint () const;
  35. virtual QSize sizeHint () const;
  36. public slots:
  37. ///
  38. /// Reset to zero
  39. void reset();
  40. protected slots:
  41. ///
  42. /// Adjust columns/rows size according to width/height
  43. void adjustRowsColumnsSize(int width, int height);
  44. protected:
  45. ///
  46. virtual void resizeEvent(QResizeEvent * event);
  47. private:
  48. CTK_DECLARE_PRIVATE(ctkMatrixWidget);
  49. };
  50. #endif