VR-Forces 4.6.1 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
appsrc
vrfOpdEditor
propertyItem.h
Go to the documentation of this file.
1
/*******************************************************************************
2
** Copyright (c) 2013 MAK Technologies, Inc.
3
** All rights reserved.
4
*******************************************************************************/
5
6
#pragma once
7
8
#include <
vrvUtil/signalslib.h
>
9
10
#include <QtWidgets/QTreeWidget>
11
#include <QtWidgets/QLineEdit>
12
#include <QtGui/QKeyEvent>
13
14
class
DtReaderWriter
;
15
class
DtPropertySheet
;
16
class
QPushButton
;
17
class
DtPropertyItem
;
18
class
QHBoxLayout;
19
class
DtPropertyCreationFactory
;
20
class
DtPropertyCreationDialog
;
21
22
namespace
makVrv
23
{
24
class
DtDe;
25
}
26
27
class
DtPropertyInternalLineEdit
:
public
QLineEdit
28
{
29
public
:
30
DtPropertyInternalLineEdit
(QWidget* parent) :
QLineEdit
(parent) {};
31
virtual
void
keyPressEvent
(QKeyEvent* e)
32
{
33
QLineEdit::keyPressEvent
(e);
34
35
if
((e->key() == Qt::Key_Enter) || (e->key() == Qt::Key_Return))
36
{
37
e->accept();
38
clearFocus();
39
}
40
};
41
};
42
43
class
DtPropertyItem
:
public
QObject
,
public
QTreeWidgetItem
44
{
45
Q_OBJECT
46
47
public
:
48
DtPropertyItem
(
makVrv::DtDe
&,
DtPropertySheet
*,
const
QString& title,
DtReaderWriter
* var,
49
DtReaderWriter
* backup);
50
DtPropertyItem
(
makVrv::DtDe
&,
DtPropertyItem
*,
DtPropertySheet
*,
const
QString& title,
51
DtReaderWriter
* var = NULL,
DtReaderWriter
* backup = NULL);
52
53
virtual
~DtPropertyItem
();
54
55
virtual
void
showEditor
();
56
virtual
void
hideEditor
();
57
virtual
bool
hasSubItems
()
const
;
58
59
virtual
int
numParents
()
const
;
60
61
virtual
void
init
();
62
63
DtPropertySheet
*
propertySheet
();
64
65
void
setReaderWriterVariable
(
DtReaderWriter
*);
66
DtReaderWriter
*
readerWriterVariable
();
67
68
void
setReaderWriterBackup
(
DtReaderWriter
*);
69
DtReaderWriter
*
readerWriterBackup
();
70
71
virtual
void
setUserData
(
void
*);
72
void
*
userData
()
const
;
73
74
void
setKeyword
(
const
QString&);
75
const
QString&
keyword
()
const
;
76
77
virtual
void
savedOpdFile
();
78
virtual
bool
isChanged
()
const
;
79
virtual
bool
isNew
()
const
{
return
myIsNew
; };
80
virtual
void
setNew
(
bool
b) {
myIsNew
= b; };
81
virtual
bool
isDeleted
()
const
;
82
virtual
bool
canRestore
()
const
;
83
84
virtual
void
setReadOnly
(
bool
);
85
86
// Sets this item and all children read only
87
virtual
void
setRecursiveReadOnly
(
bool
);
88
virtual
bool
readOnly
()
const
;
89
90
// By default, false
91
virtual
bool
canCreateItem
()
const
;
92
virtual
bool
canDeleteItem
()
const
;
93
virtual
bool
canMakeVariable
()
const
;
94
virtual
bool
handlesDelete
()
const
;
95
96
// Must set in order to add items
97
static
void
setPropertyCreationFactory
(
DtPropertyCreationFactory
*);
98
static
DtPropertyCreationFactory
*
propertyCreationFactory
();
99
100
virtual
QVariant
data
(
int
column,
int
role)
const
;
101
virtual
QVariant
data
()
const
;
102
103
virtual
QString
dialogType
()
const
;
104
105
virtual
void
deleteItem
(
DtPropertyItem
*);
106
107
void
setCanDeleteItem
(
bool
b) {
myCanDeleteItem
= b; };
108
109
// Base class simply calls restore
110
virtual
void
internalRestore
();
111
virtual
DtPropertyItem
*
itemWithReaderWriterVariable
(
DtReaderWriter
*);
112
virtual
DtPropertyItem
*
itemWithName
(
const
QString& name);
113
114
void
repaint
() { setData(0, 1000,
"repaint"
); };
115
116
virtual
void
setAttachedTo
(
DtReaderWriter
*);
117
DtReaderWriter
*
attachedTo
();
118
119
public
slots:
120
virtual
void
restore
();
121
virtual
void
updateValue
();
122
virtual
void
addItem
(
bool
createPropertyEntry =
true
);
123
124
// Emits removeItem signal
125
virtual
void
deleteItem
();
126
127
// Called when a dialog signals that a new item is to be created
128
virtual
void
addNewPropertyItem
(
DtPropertyCreationDialog
*);
129
130
// Repaints immediate children of this item
131
virtual
void
repaintChildren
();
132
133
virtual
bool
isVariable
()
const
;
134
135
protected
slots:
136
virtual
void
changeVariableStatus
();
137
virtual
void
updateVariable
();
138
139
protected
:
140
virtual
void
placeEditor
(QWidget *w);
141
virtual
void
updateResetButtonState
();
142
virtual
void
setFocus
(QWidget *w);
143
144
// Calls createResetButton(), createAddButton(), createDeleteButton()
145
virtual
void
createButtons
();
146
147
virtual
void
createVariableButton
();
148
virtual
void
createResetButton
();
149
virtual
void
createAddButton
();
150
virtual
void
createDeleteButton
();
151
virtual
bool
hasDeletedItems
()
const
;
152
virtual
bool
hasNewItems
()
const
;
153
154
virtual
void
setupValue
();
155
virtual
void
setupLayout
();
156
virtual
int
buttonWidths
()
const
;
157
virtual
void
setupVariable
();
158
159
// Walk the parent tree to tell parents child has been notified
160
virtual
void
notifyValueUpdated
(
DtPropertyItem
* itemUpdated);
161
162
virtual
QString
addToolTip
()
const
;
163
164
virtual
void
deleteChildItem
(
DtPropertyItem
*);
165
virtual
void
addChildItem
(
DtPropertyItem
*);
166
167
protected
:
168
makVrv::DtDe
&
myDe
;
169
DtReaderWriter
*
myReaderWriterVariable
;
170
DtReaderWriter
*
myReaderWriterBackup
;
171
DtReaderWriter
*
myAttachedTo
;
172
173
DtPropertySheet
*
myPropertySheet
;
174
QPushButton
*
myResetButton
;
175
QPushButton
*
myAddButton
;
176
QPushButton
*
myDeleteButton
;
177
QPushButton
*
myVariableButton
;
178
bool
myDeleteRwValue
;
179
bool
myIsNew
;
180
181
QFrame*
myButtonBox
;
182
void
*
myUserData
;
183
QString
myKeyword
;
184
QLineEdit
*
myVariableEdit
;
185
186
bool
myReadOnly
;
187
bool
myCanDeleteItem
;
188
189
static
DtPropertyCreationFactory
*
thePropertyCreationFactory
;
190
};
191
192
typedef
DtPropertyItem
* (*DtPICreator)(
makVrv::DtDe
&,
DtPropertySheet
*,
DtPropertyItem
*,
const
QString&,
193
DtReaderWriter
* p,
DtReaderWriter
* b);
194
195
inline
DtPropertySheet
*
DtPropertyItem::propertySheet
()
196
{
197
return
myPropertySheet
;
198
}
199
200
inline
DtReaderWriter
*
DtPropertyItem::readerWriterVariable
()
201
{
202
return
myReaderWriterVariable
;
203
}
204
205
inline
void
DtPropertyItem::setReaderWriterVariable
(
DtReaderWriter
* p)
206
{
207
myReaderWriterVariable
= p;
208
}
209
210
inline
DtReaderWriter
*
DtPropertyItem::readerWriterBackup
()
211
{
212
return
myReaderWriterBackup
;
213
}
214
215
inline
void
DtPropertyItem::setReaderWriterBackup
(
DtReaderWriter
* p)
216
{
217
myReaderWriterBackup
= p;
218
}
219
220
inline
void
*
DtPropertyItem::userData
()
const
221
{
222
return
myUserData
;
223
}
224
225
inline
void
DtPropertyItem::setKeyword
(
const
QString& k)
226
{
227
myKeyword
= k;
228
}
229
230
inline
const
QString&
DtPropertyItem::keyword
()
const
231
{
232
return
myKeyword
;
233
}
234
235
inline
DtReaderWriter
*
DtPropertyItem::attachedTo
()
236
{
237
return
myAttachedTo
;
238
}
Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (
www.mak.com
)