Field editor for atomic type QVariant managed using a single line edit using QtPropertyBrowser. More...
#include <QtPropertyFieldEditor.h>
Inheritance diagram for QtPropertyFieldEditor:
Collaboration diagram for QtPropertyFieldEditor:Public Slots | |
| void | currentIndexChanged (int index) |
| for editable enum: called when the selected item has changed in order to let the user edit only the last line (not the other values) | |
| void | editTextChanged (const QString &newValue) |
| for editable enum: called when the modifiable value has changed | |
| void | valueChangedInPropertyField (QtProperty *property, const QVariant &value) |
| for anything but enum: called when the edited value has changed | |
Public Member Functions | |
| bool | eventFilter (QObject *obj, QEvent *event) override |
| filters wheel events for enum (edited as QComboBox) as it is too easy to modify the value when the mouse is just hovering on the QComboBox and could have disastrous consequences | |
| virtual QWidget * | getWidget () override |
| Build an line edit for the encapsulated VariantDataModel. | |
| QtPropertyFieldEditor (CamiTKExtensionModelPresenter *presenter, VariantDataModel &dataModel, const QString &name="", const QString &description="", const QVariant &defaultValue=QVariant()) | |
| Constructor If the model value is invalid (not yet present in the CamiTKExtensionModel), use the provided default value to create a new data model. | |
| void | setCheckBoxText (QString checkBoxText) |
| for boolean: set the text to appear besides the check box (instead of default True/False) (this is useful for compact field editor) | |
| void | setDecimals (int decimals) |
| for double/int: set the number of decimal values | |
| void | setEditableEnum (bool editableEnums) |
| if true, the last item is editable | |
| void | setEnumValues (const QStringList &enumValues) |
| For enums: set the values. | |
| void | setLabelToUpdateWithFieldValue (QLabel *labelToUpdate) |
| set the label to update/synchronize when the current field is modified | |
| void | setMandatory (bool isMandatory) |
| if isMandatory is true, the presenter gets a warning message if the value becomes empty | |
| void | setMaximum (QVariant maximum) |
| for double/int: set the maximum value | |
| void | setMinimum (QVariant minimum) |
| for double/int: set the minimum value | |
| void | setPlaceHolderText (const QString &placeHolderText) |
| set the displayed text when the field value is empty | |
| void | setReadOnly (bool isReadOnly) |
| if isReadOnly is true the field value cannot be modified | |
| void | setRegExp (const QString ®Exp) |
| For strings: set the regexp validator for QString properties and editable enums. | |
| void | setTabWidgetTitle (bool isTabWidgetTitle) |
| it isTabWidgetTitle is true, look for a parent widget that is a TabWidget and sets its text to the current field value every time it changes | |
| void | setTitleCase (bool isTitleCase) |
| For strings: ensure the value has a title case format. | |
Public Member Functions inherited from FieldEditor | |
| virtual void | appendRowTo (QGridLayout *layout, bool canBeDeleted=false) |
| Adds a row at the end of the given layout with two columns: | |
| FieldEditor (CamiTKExtensionModelPresenter *presenter, VariantDataModel &dataModel, const QString &name="", const QString &description="") | |
| Constructor Creates a field for the given data model inside the given presenter A name and description can be associated with the field (it will be used when the field is added to a gridlayout,. | |
| void | setEnabled (bool isEnabled) |
| Is the widget and labels currently enabled. | |
| virtual | ~FieldEditor () |
| Destructor (delete myWidget) | |
Additional Inherited Members | |
Signals inherited from FieldEditor | |
| void | valueChanged (VariantDataModel &changedDataModel) |
| emitted when the edited value has changed (useful to synchronize other field editor depending of this editor current value) | |
Protected Slots inherited from FieldEditor | |
| virtual void | deleteButtonClicked () |
| Called when the (optional) delete button is called This will make user the user knows what she/he does If deletion is confirmed by the user, remove the data model. | |
Protected Attributes inherited from FieldEditor | |
| VariantDataModel & | dataModel |
| The edited data model (part of the presenter's full model) | |
| QString | description |
| Description (displayed as tool tip / what's that) | |
| QGridLayout * | myGridLayout |
| where the widget is added | |
| QWidget * | myWidget |
| The created widget (inheriting must use this to create their widgets) | |
| QString | name |
| Name of the field (displayed as a label) | |
| CamiTKExtensionModelPresenter * | presenter |
| The presenter that contains the full VariantDataModel. | |
| QLabel * | rowLabel |
| the row label widget (that contains the name of the row) the label text can be modified (see CamiTKPropertyFieldEditor.h for an example) | |
Field editor for atomic type QVariant managed using a single line edit using QtPropertyBrowser.
This field editor can manage
For string setting a specific format will modify the user input to follow a given regexp everytime the user modify the field value (e.g. to ensure the field starts with an upper case letter or a number use setFormat(R"(^[A-Z0-9].*)"))
Usage example:
| QtPropertyFieldEditor::QtPropertyFieldEditor | ( | CamiTKExtensionModelPresenter * | presenter, |
| VariantDataModel & | dataModel, | ||
| const QString & | name = "", |
||
| const QString & | description = "", |
||
| const QVariant & | defaultValue = QVariant() |
||
| ) |
Constructor If the model value is invalid (not yet present in the CamiTKExtensionModel), use the provided default value to create a new data model.
| defaultValue | if given, used to set the data model if it does not exist yet |
References FieldEditor::dataModel, and VariantDataModel::getValue().
Here is the call graph for this function:
|
slot |
for editable enum: called when the selected item has changed in order to let the user edit only the last line (not the other values)
References FieldEditor::myWidget.
Referenced by getWidget().
Here is the caller graph for this function:
|
slot |
for editable enum: called when the modifiable value has changed
References FieldEditor::dataModel, CamiTKExtensionModelPresenter::modelUpdated(), FieldEditor::presenter, and FieldEditor::valueChanged().
Referenced by getWidget().
Here is the call graph for this function:
Here is the caller graph for this function:
|
override |
filters wheel events for enum (edited as QComboBox) as it is too easy to modify the value when the mouse is just hovering on the QComboBox and could have disastrous consequences
|
overridevirtual |
Build an line edit for the encapsulated VariantDataModel.
Implements FieldEditor.
References QtAbstractEditorFactory< PropertyManager >::addPropertyManager(), CAMITK_WARNING, currentIndexChanged(), FieldEditor::dataModel, FieldEditor::description, editTextChanged(), VariantDataModel::getName(), FieldEditor::myWidget, QtVariantProperty::setAttribute(), QtBoolEdit::setTextVisible(), VariantDataModel::toString(), QtVariantPropertyManager::valueChanged(), and valueChangedInPropertyField().
Referenced by CamiTKPropertyFieldEditor::buildTypeDependentEditors(), and CamiTKPropertyFieldEditor::getWidget().
Here is the call graph for this function:
Here is the caller graph for this function:| void QtPropertyFieldEditor::setCheckBoxText | ( | QString | checkBoxText | ) |
for boolean: set the text to appear besides the check box (instead of default True/False) (this is useful for compact field editor)
Referenced by CamiTKPropertyFieldEditor::getWidget().
Here is the caller graph for this function:| void QtPropertyFieldEditor::setDecimals | ( | int | decimals | ) |
for double/int: set the number of decimal values
References QtVariantProperty::setAttribute().
Referenced by CamiTKPropertyFieldEditor::buildTypeDependentEditors().
Here is the call graph for this function:
Here is the caller graph for this function:| void QtPropertyFieldEditor::setEditableEnum | ( | bool | editableEnums | ) |
if true, the last item is editable
Referenced by ActionTabPresenter::ActionTabPresenter(), and ExtensionTabPresenter::ExtensionTabPresenter().
Here is the caller graph for this function:| void QtPropertyFieldEditor::setEnumValues | ( | const QStringList & | enumValues | ) |
For enums: set the values.
Referenced by ActionTabPresenter::ActionTabPresenter(), CppActionTabPresenter::CppActionTabPresenter(), ExtensionTabPresenter::ExtensionTabPresenter(), CamiTKPropertyFieldEditor::getWidget(), and PythonActionTabPresenter::PythonActionTabPresenter().
Here is the caller graph for this function:| void QtPropertyFieldEditor::setLabelToUpdateWithFieldValue | ( | QLabel * | labelToUpdate | ) |
set the label to update/synchronize when the current field is modified
Referenced by CamiTKPropertyFieldEditor::appendRowTo().
Here is the caller graph for this function:| void QtPropertyFieldEditor::setMandatory | ( | bool | isMandatory | ) |
if isMandatory is true, the presenter gets a warning message if the value becomes empty
Referenced by CamiTKPropertyFieldEditor::getWidget().
Here is the caller graph for this function:| void QtPropertyFieldEditor::setMaximum | ( | QVariant | maximum | ) |
for double/int: set the maximum value
References QtVariantProperty::setAttribute().
Referenced by CamiTKPropertyFieldEditor::buildTypeDependentEditors().
Here is the call graph for this function:
Here is the caller graph for this function:| void QtPropertyFieldEditor::setMinimum | ( | QVariant | minimum | ) |
for double/int: set the minimum value
References QtVariantProperty::setAttribute().
Referenced by CamiTKPropertyFieldEditor::buildTypeDependentEditors().
Here is the call graph for this function:
Here is the caller graph for this function:| void QtPropertyFieldEditor::setPlaceHolderText | ( | const QString & | placeHolderText | ) |
set the displayed text when the field value is empty
Referenced by ActionTabPresenter::ActionTabPresenter(), CamiTKPropertyFieldEditor::buildTypeDependentEditors(), ExtensionTabPresenter::ExtensionTabPresenter(), and CamiTKPropertyFieldEditor::getWidget().
Here is the caller graph for this function:| void QtPropertyFieldEditor::setReadOnly | ( | bool | isReadOnly | ) |
if isReadOnly is true the field value cannot be modified
Referenced by ActionTabPresenter::ActionTabPresenter(), and ExtensionTabPresenter::ExtensionTabPresenter().
Here is the caller graph for this function:| void QtPropertyFieldEditor::setRegExp | ( | const QString & | regExp | ) |
For strings: set the regexp validator for QString properties and editable enums.
Referenced by ActionTabPresenter::ActionTabPresenter(), CamiTKPropertyFieldEditor::buildTypeDependentEditors(), and ExtensionTabPresenter::ExtensionTabPresenter().
Here is the caller graph for this function:| void QtPropertyFieldEditor::setTabWidgetTitle | ( | bool | isTabWidgetTitle | ) |
it isTabWidgetTitle is true, look for a parent widget that is a TabWidget and sets its text to the current field value every time it changes
| void QtPropertyFieldEditor::setTitleCase | ( | bool | isTitleCase | ) |
For strings: ensure the value has a title case format.
Referenced by CamiTKPropertyFieldEditor::getWidget().
Here is the caller graph for this function:
|
slot |
for anything but enum: called when the edited value has changed
References FieldEditor::dataModel, CamiTKExtensionModelPresenter::emitShowMessage(), isDigit, CamiTKExtensionModelPresenter::modelUpdated(), FieldEditor::myWidget, FieldEditor::name, FieldEditor::presenter, and FieldEditor::valueChanged().
Referenced by getWidget().
Here is the call graph for this function:
Here is the caller graph for this function: