Remoto - VFS
|
Base class for all form field types. More...
#include <VFS_form_field.h>
Public Member Functions | |
VFS_form_field (QJsonValue val, QString type, QString label="", QString tip="") | |
VFS_form_field (QString type) | |
void | clearOption (QString o) |
Clear/remove a widget option. More... | |
int | getIndex () |
Get the field index. More... | |
QString | getLabel () |
Return the label. More... | |
void | setAllowEmpty (bool e) |
Validate this field against empty-ness. More... | |
void | setEnabled (bool e) |
Enable or disable this field. More... | |
void | setHidden (bool e) |
Keep the field, but hide it when rendering. More... | |
void | setHideLabel (bool l) |
Hide the label for this field. More... | |
void | setIndex (int i) |
Set the field index for this widget. More... | |
void | setLabel (QString l, bool replace=true) |
Set the label. More... | |
void | setOption (QString o, QJsonValue v) |
Set a widget option. More... | |
void | setSpellcheck (bool s) |
Enable or disable spellchecking on this text field. More... | |
void | setTip (QString t) |
Set the tooltip. More... | |
void | setValue (QJsonValue val) |
Set the value. More... | |
Protected Attributes | |
QJsonObject | options |
Options for any widget type... this is an arbitrary list. More... | |
Base class for all form field types.
As this is a subclass of a QJsonObject, it's basically a series of convenience functions for constructing an object in the correct form.
A field should have:
and possibly an options entry:
Different field types will add their own options as needed.
Definition at line 6 of file VFS_form_field.h.
|
explicit |
type | The type of this widget |
All subclasses should specify a type, as that will determine the validation and rendering rules for this object.
Definition at line 34 of file VFS_form_field.cpp.
|
explicit |
val | initial value for this field |
type | The type of this widget |
label | label to display |
tip | tooltip for mouseover |
Definition at line 48 of file VFS_form_field.cpp.
void VFS_form_field::clearOption | ( | QString | o | ) |
Clear/remove a widget option.
o | Option name |
Remove an option from the options object, whether it exists or not.
Definition at line 117 of file VFS_form_field.cpp.
int VFS_form_field::getIndex | ( | ) |
Get the field index.
Get the field index for this widget.
Return the index used for display sorting.
Definition at line 154 of file VFS_form_field.cpp.
QString VFS_form_field::getLabel | ( | ) |
Return the label.
Get the label for this widget.
Definition at line 89 of file VFS_form_field.cpp.
void VFS_form_field::setAllowEmpty | ( | bool | e | ) |
Validate this field against empty-ness.
Set the validator to allow empty values for this widget.
e | Allow empty or not |
Definition at line 164 of file VFS_form_field.cpp.
void VFS_form_field::setEnabled | ( | bool | e | ) |
Enable or disable this field.
Set enabled on this widget.
e | The enabled state |
A widget that is not enabled will be visible but not editable.
Definition at line 176 of file VFS_form_field.cpp.
void VFS_form_field::setHidden | ( | bool | e | ) |
Keep the field, but hide it when rendering.
Hide or show this widget.
e | The hide state |
A widget that is hidden will not be visible, but will receive diffs and other events.
Definition at line 188 of file VFS_form_field.cpp.
void VFS_form_field::setHideLabel | ( | bool | l | ) |
Hide the label for this field.
Hide or show the label for this widget.
l | The label visibility state |
A widget that hides its label will still create a label div, but not show it.
Definition at line 200 of file VFS_form_field.cpp.
void VFS_form_field::setIndex | ( | int | i | ) |
Set the field index for this widget.
i | index value |
The JSON spec specifies that JsonObject order is not kept during serialization.
Field indexes are sorted based on this value before being displayed.
Definition at line 142 of file VFS_form_field.cpp.
void VFS_form_field::setLabel | ( | QString | label, |
bool | replace = true |
||
) |
Set the label.
Set the label for this widget.
label | The label for this field |
replace | If the label has already been set, replace it. |
If the label has already been set, this method will do nothing unless replace is set. This is useful for subclasses.
Definition at line 77 of file VFS_form_field.cpp.
void VFS_form_field::setOption | ( | QString | o, |
QJsonValue | v | ||
) |
Set a widget option.
o | Option name |
v | Option value |
Beware that this does not do any sanitization based on type, it just sets the option in the JSON object.
Definition at line 102 of file VFS_form_field.cpp.
void VFS_form_field::setSpellcheck | ( | bool | s | ) |
Enable or disable spellchecking on this text field.
For text-based widgets, set the spellcheck flag on the field.
s | The spellcheck state |
Definition at line 210 of file VFS_form_field.cpp.
void VFS_form_field::setTip | ( | QString | tip | ) |
Set the tooltip.
Set the mouseover tip for a widget.
tip | The string displayed |
Definition at line 127 of file VFS_form_field.cpp.
void VFS_form_field::setValue | ( | QJsonValue | val | ) |
Set the value.
Set the value for this widget.
val | The value for this field |
Definition at line 64 of file VFS_form_field.cpp.
|
protected |
Options for any widget type... this is an arbitrary list.
Definition at line 34 of file VFS_form_field.h.