Remoto - VFS: VFS_form_field.cpp Source File
Remoto - VFS
VFS_form_field.cpp
Go to the documentation of this file.
1 
2 #include "VFS_form_field.h"
3 
35 : QJsonObject()
36 //, _include(true)
37 {
38  insert("type",type);
39 }
40 
48 VFS_form_field::VFS_form_field(QJsonValue val, QString type, QString label, QString tip)
49 : QJsonObject()
50 {
51  insert("type",type);
52  insert("value",val);
53 
54  //setValue(val);
55  setLabel(label);
56  setTip(tip);
57 }
58 
64 void VFS_form_field::setValue(QJsonValue val)
65 {
66  insert("value",val);
67 }
68 
77 void VFS_form_field::setLabel(QString label, bool replace)
78 {
79  if (label != "")
80  if (replace || !contains("label"))
81  insert("label",label);
82 }
83 
90 {
91  return value("label").toString();
92 }
93 
102 void VFS_form_field::setOption(QString o, QJsonValue v)
103 {
104  options[o] = v;
105 
106  //if (!contains("options"))
107  insert("options",options);
108 }
109 
118 {
119  options.remove(o);
120 }
121 
127 void VFS_form_field::setTip(QString tip)
128 {
129  if (tip != "")
130  insert("tip",tip);
131 }
132 
143 {
144  insert("index",i);
145 }
146 
155 {
156  return value("index").toInt();
157 }
158 
165 {
166  setOption("allowEmpty",e);
167 }
168 
177 {
178  setOption("enabled",e);
179 }
180 
189 {
190  setOption("hidden",e);
191 }
192 
201 {
202  setOption("hideLabel",l);
203 }
204 
211 {
212  setOption("spellcheck",s);
213 }
214 
215 /*
216 void VFS_form_field::setInclude(bool i)
217 {
218  setOption("include",i);
219 }
220 */
221 
void setEnabled(bool e)
Enable or disable this field.
void setSpellcheck(bool s)
Enable or disable spellchecking on this text field.
QString getLabel()
Return the label.
void setAllowEmpty(bool e)
Validate this field against empty-ness.
VFS_form_field(QString type)
void setOption(QString o, QJsonValue v)
Set a widget option.
void setLabel(QString l, bool replace=true)
Set the label.
void setTip(QString t)
Set the tooltip.
void setHidden(bool e)
Keep the field, but hide it when rendering.
void setHideLabel(bool l)
Hide the label for this field.
void clearOption(QString o)
Clear/remove a widget option.
void setValue(QJsonValue val)
Set the value.
int getIndex()
Get the field index.
QJsonObject options
Options for any widget type... this is an arbitrary list.
void setIndex(int i)
Set the field index for this widget.
setter type
a setter DOCME