cisst-saw
Loading...
Searching...
No Matches
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 Author(s): Anton Deguet
6 Created on: 2011-12-08
7
8 (C) Copyright 2011-2020 Johns Hopkins University (JHU), All Rights Reserved.
9
10--- begin cisst license - do not edit ---
11
12This software is provided "as is" under an open source license, with
13no warranty. The complete license can be found in license.txt and
14http://www.cisst.org/cisst/license.txt.
15
16--- end cisst license ---
17
18*/
19
20#ifndef _vctQtWidgetDynamicVector_h
21#define _vctQtWidgetDynamicVector_h
22
23#include <QTableWidget>
24
27
28// Always include last
30
32{
33 Q_OBJECT;
34public:
36};
37
38template <class _elementType>
40{
41 typedef _elementType value_type;
42 int Precision;
43 char Format;
44public:
47 void SetPrecision(const int precision);
48 void SetFormat(const char format);
49};
50
51template <class _elementType>
53{
54 typedef _elementType value_type;
55 int Base;
56public:
59 void SetBase(const int base);
60};
61
62#if (CISST_OS == CISST_WINDOWS) && defined(CISST_COMPILER_IS_MSVC)
63#pragma warning ( disable : 4661 )
69#endif // CISST_WINDOWS
70
71
73{
74 Q_OBJECT;
75public:
76 typedef enum {TEXT_WIDGET, SPINBOX_WIDGET, SLIDER_WIDGET} DisplayModeType;
78signals:
79 void valueChanged(void);
80protected:
81 enum {SLIDER_RESOLUTION = 1000};
83protected slots:
84 void SliderValueChangedSlot(int value);
87 void ItemChangedSlot(QTableWidgetItem * item);
88};
89
90template <class _elementType>
92{
93 typedef _elementType value_type;
94 int Precision;
95 char Format;
96 value_type Minimum, Maximum, Step;
97 vctDynamicVector<value_type> Minimums, Maximums;
98public:
100 virtual bool SetValue(const vctDynamicVector<value_type> & value, bool blockSignals = true);
101 virtual bool GetValue(vctDynamicVector<value_type> & placeHolder) const;
102 void SetPrecision(const int precision);
103 void SetFormat(const char format);
104 void SetRange(const value_type minimum, const value_type maximum);
106 void SetStep(const value_type step);
107protected:
110 value_type GetMinimum(const size_t index) const;
111 value_type GetMaximum(const size_t index) const;
112};
113
114template <class _elementType>
116{
117 typedef _elementType value_type;
118 int Base;
119 value_type Minimum, Maximum, Step;
120public:
122 virtual bool SetValue(const vctDynamicVector<value_type> & value, bool blockSignals = true);
123 virtual bool GetValue(vctDynamicVector<value_type> & placeHolder) const;
124 void SetBase(const int base);
125 void SetRange(const value_type minimum, const value_type maximum);
126 void SetStep(const value_type step);
127};
128
129#if (CISST_OS == CISST_WINDOWS) && defined(CISST_COMPILER_IS_MSVC)
130#pragma warning ( disable : 4661 )
135#endif // CISST_WINDOWS
136
137
138// -- for bools
140{
141 Q_OBJECT;
142 public:
144 virtual bool SetValue(const vctDynamicVector<bool> & value, bool blockSignals = true);
145 virtual bool GetValue(vctDynamicVector<bool> & placeHolder) const;
146signals:
147 bool valueChanged(void);
148protected slots:
149 void ValueChangedSlot(bool value);
150};
151
152#endif // _vctQtWidgetDynamicVector_h
Dynamic vector referencing existing memory (const).
Definition vctDynamicConstVectorRef.h:79
Definition vctForwardDeclarations.h:131
virtual bool GetValue(vctDynamicVector< bool > &placeHolder) const
virtual bool SetValue(const vctDynamicVector< bool > &value, bool blockSignals=true)
Definition vctQtWidgetDynamicVector.h:40
void SetPrecision(const int precision)
virtual bool SetValue(const vctDynamicConstVectorRef< value_type > &value)
void SetFormat(const char format)
Definition vctQtWidgetDynamicVector.h:53
virtual bool SetValue(const vctDynamicConstVectorRef< value_type > &value)
void ItemChangedSlot(QTableWidgetItem *item)
vctQtWidgetDynamicVectorWriteBase(const DisplayModeType displayMode)
@ SLIDER_RESOLUTION
Definition vctQtWidgetDynamicVector.h:81
void SliderValueChangedSlot(int value)
DisplayModeType DisplayMode
Definition vctQtWidgetDynamicVector.h:82
DisplayModeType
Definition vctQtWidgetDynamicVector.h:76
@ TEXT_WIDGET
Definition vctQtWidgetDynamicVector.h:76
@ SLIDER_WIDGET
Definition vctQtWidgetDynamicVector.h:76
@ SPINBOX_WIDGET
Definition vctQtWidgetDynamicVector.h:76
Definition vctQtWidgetDynamicVector.h:92
value_type GetMinimum(const size_t index) const
void SetFormat(const char format)
void SetRange(const vctDynamicVector< value_type > &minimums, const vctDynamicVector< value_type > &maximums)
virtual bool GetValue(vctDynamicVector< value_type > &placeHolder) const
void SetRange(const value_type minimum, const value_type maximum)
virtual bool SetValue(const vctDynamicVector< value_type > &value, bool blockSignals=true)
vctQtWidgetDynamicVectorWriteFloating(const DisplayModeType displayMode=TEXT_WIDGET)
value_type GetMaximum(const size_t index) const
void SetStep(const value_type step)
void SetPrecision(const int precision)
Definition vctQtWidgetDynamicVector.h:116
virtual bool SetValue(const vctDynamicVector< value_type > &value, bool blockSignals=true)
void SetStep(const value_type step)
virtual bool GetValue(vctDynamicVector< value_type > &placeHolder) const
vctQtWidgetDynamicVectorWriteInteger(const DisplayModeType displayMode=TEXT_WIDGET)
void SetRange(const value_type minimum, const value_type maximum)
#define CISST_EXPORT
Definition cmnExportMacros.h:50
Declaration of vctDynamicVector.
Macros to export the symbols of cisstVectorQt (in a Dll).