cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vctQtWidgetDynamicVector.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5 
6  Author(s): Anton Deguet
7  Created on: 2011-12-08
8 
9  (C) Copyright 2011-2013 Johns Hopkins University (JHU), All Rights
10  Reserved.
11 
12 --- begin cisst license - do not edit ---
13 
14 This software is provided "as is" under an open source license, with
15 no warranty. The complete license can be found in license.txt and
16 http://www.cisst.org/cisst/license.txt.
17 
18 --- end cisst license ---
19 
20 */
21 
22 #ifndef _vctQtWidgetDynamicVector_h
23 #define _vctQtWidgetDynamicVector_h
24 
25 #include <QTableWidget>
26 
29 
30 // Always include last
32 
34 {
35  Q_OBJECT;
36 public:
38 };
39 
40 template <class _elementType>
42 {
43  typedef _elementType value_type;
44  int Precision;
45  char Format;
46 public:
48  virtual bool SetValue(const vctDynamicVector<value_type> & value);
49  void SetPrecision(const int precision);
50  void SetFormat(const char format);
51 };
52 
53 template <class _elementType>
55 {
56  typedef _elementType value_type;
57  int Base;
58 public:
60  virtual bool SetValue(const vctDynamicVector<value_type> & value);
61  void SetBase(const int base);
62 };
63 
64 #if (CISST_OS == CISST_WINDOWS) && defined(CISST_COMPILER_IS_MSVC)
65 #pragma warning ( disable : 4661 )
71 #endif // CISST_WINDOWS
72 
73 
75 {
76  Q_OBJECT;
77 public:
78  typedef enum {TEXT_WIDGET, SPINBOX_WIDGET, SLIDER_WIDGET} DisplayModeType;
79  vctQtWidgetDynamicVectorWriteBase(const DisplayModeType displayMode);
80  void SetDisplayMode(const DisplayModeType displayMode);
81 signals:
82  void valueChanged(void);
83 protected:
84  enum {SLIDER_RESOLUTION = 1000};
86 protected slots:
87  void SliderValueChangedSlot(int value);
88  void DoubleSpinBoxValueChangedSlot(double value);
89  void SpinBoxValueChangedSlot(int value);
90  void ItemChangedSlot(QTableWidgetItem * item);
91 };
92 
93 template <class _elementType>
95 {
96  typedef _elementType value_type;
97  int Precision;
98  char Format;
99  value_type Minimum, Maximum, Step;
100  vctDynamicVector<value_type> Minimums, Maximums;
101 public:
102  vctQtWidgetDynamicVectorWriteFloating(const DisplayModeType displayMode = TEXT_WIDGET);
103  virtual bool SetValue(const vctDynamicVector<value_type> & value, bool blockSignals = true);
104  virtual bool GetValue(vctDynamicVector<value_type> & placeHolder) const;
105  void SetPrecision(const int precision);
106  void SetFormat(const char format);
107  void SetRange(const value_type minimum, const value_type maximum);
108  void SetRange(const vctDynamicVector<value_type> & minimums, const vctDynamicVector<value_type> & maximums);
109  void SetStep(const value_type step);
110 protected:
111  void UpdateWidgetPrecision(void);
112  void UpdateWidgetRange(void);
113  value_type GetMinimum(const size_t index) const;
114  value_type GetMaximum(const size_t index) const;
115 };
116 
117 template <class _elementType>
119 {
120  typedef _elementType value_type;
121  int Base;
122  value_type Minimum, Maximum, Step;
123 public:
124  vctQtWidgetDynamicVectorWriteInteger(const DisplayModeType displayMode = TEXT_WIDGET);
125  virtual bool SetValue(const vctDynamicVector<value_type> & value, bool blockSignals = true);
126  virtual bool GetValue(vctDynamicVector<value_type> & placeHolder) const;
127  void SetBase(const int base);
128  void SetRange(const value_type minimum, const value_type maximum);
129  void SetStep(const value_type step);
130 };
131 
132 #if (CISST_OS == CISST_WINDOWS) && defined(CISST_COMPILER_IS_MSVC)
133 #pragma warning ( disable : 4661 )
138 #endif // CISST_WINDOWS
139 
140 
141 // -- for bools
143 {
144  Q_OBJECT;
145  public:
147  virtual bool SetValue(const vctDynamicVector<bool> & value, bool blockSignals = true);
148  virtual bool GetValue(vctDynamicVector<bool> & placeHolder) const;
149 signals:
150  bool valueChanged(void);
151 protected slots:
152  void ValueChangedSlot(bool value);
153 };
154 
155 #endif // _vctQtWidgetDynamicVector_h
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
Definition: vctQtForwardDeclarations.h:27
Definition: vctQtWidgetDynamicVector.h:74
Definition: vctQtWidgetDynamicVector.h:142
Definition: vctQtForwardDeclarations.h:25
DisplayModeType
Definition: vctQtWidgetDynamicVector.h:78
DisplayModeType DisplayMode
Definition: vctQtWidgetDynamicVector.h:85
Declaration of vctDynamicVector.
Definition: vctQtWidgetDynamicVector.h:33
Macros to export the symbols of cisstVectorQt (in a Dll).
Definition: vctQtForwardDeclarations.h:38
Definition: vctQtWidgetDynamicVector.h:78
Definition: vctQtForwardDeclarations.h:36