Tome
A generic data editor for games supporting arbitrary input and output formats.
Public Member Functions | Protected Member Functions | List of all members
Tome::FieldValueWidget Class Reference

Changes its appearance depending on the specified type. More...

#include <fieldvaluewidget.h>

Inheritance diagram for Tome::FieldValueWidget:

Public Member Functions

 FieldValueWidget (FacetsController &facetsController, ProjectController &projectController, RecordsController &recordsController, TypesController &typesController, QWidget *parent=0)
 Constructs a new widget that changes its appearance depending on the specified type. More...
 
QString getFieldType () const
 Gets the current type of the values changed by this widget. More...
 
QVariant getFieldValue () const
 Gets the current value of this widget. More...
 
void setFieldType (const QString &fieldType)
 Sets the current type of the values changed by this widget. More...
 
void setFieldValue (const QVariant &fieldValue)
 Sets the current value of this widget. More...
 
QString validate ()
 Validates the current value against all facets of its type. More...
 

Protected Member Functions

virtual void focusInEvent (QFocusEvent *event) Q_DECL_OVERRIDE
 Sets the focus to the current widget, if any, and pre-selects any content. More...
 

Detailed Description

Changes its appearance depending on the specified type.

Constructor & Destructor Documentation

◆ FieldValueWidget()

FieldValueWidget::FieldValueWidget ( FacetsController facetsController,
ProjectController projectController,
RecordsController recordsController,
TypesController typesController,
QWidget *  parent = 0 
)
explicit

Constructs a new widget that changes its appearance depending on the specified type.

Parameters
facetsControllerController for validating type facets.
projectControllerController for creating, loading and saving projects.
recordsControllerController for adding, updating and removing records.
typesControllerController for adding, updating and removing custom types.
parentOptional owner widget.

Member Function Documentation

◆ focusInEvent()

void FieldValueWidget::focusInEvent ( QFocusEvent *  event)
protectedvirtual

Sets the focus to the current widget, if any, and pre-selects any content.

Parameters
eventEvent for focusing this widget.

◆ getFieldType()

QString FieldValueWidget::getFieldType ( ) const

Gets the current type of the values changed by this widget.

Returns
Current type of the values changed by this widget.

◆ getFieldValue()

QVariant FieldValueWidget::getFieldValue ( ) const

Gets the current value of this widget.

Exceptions
std::runtime_errorif the current field type is unknown.
Returns
Current value of this widget.

◆ setFieldType()

void FieldValueWidget::setFieldType ( const QString &  fieldType)

Sets the current type of the values changed by this widget.

Exceptions
std::runtime_errorif the field type is unknown.
Parameters
fieldTypeCurrent type of the values changed by this widget.

◆ setFieldValue()

void FieldValueWidget::setFieldValue ( const QVariant &  fieldValue)

Sets the current value of this widget.

Exceptions
std::runtime_errorif the current field type is unknown.
Parameters
fieldValueCurrent value of this widget.

◆ validate()

QString FieldValueWidget::validate ( )

Validates the current value against all facets of its type.

Returns
Translated error message, if any validation errors occur, and an empty string otherwise.

The documentation for this class was generated from the following files: