FOSSredder 0.5.0
Loading...
Searching...
No Matches
ui::PropertyViewModel Class Reference

Owns editable property UI state and delegates property CRUD to workspace. More...

#include <PropertyViewModel.h>

Inheritance diagram for ui::PropertyViewModel:
Collaboration diagram for ui::PropertyViewModel:

Signals

void changed ()
 Emitted when property view model state changed.

Public Member Functions

 PropertyViewModel (WorkspaceStore *store, WorkspaceCommands *commands, WorkspaceSelection *selection, WorkspaceSelectors *selectors, QObject *parent=nullptr)
 Creates the property view model bound to workspace roles.
QString currentId () const
 Returns the currently selected property id.
QString name () const
 Returns the editable property name.
void setName (const QString &value)
 Updates the editable property name.
QVariantList aliases () const
 Returns editable property aliases.
void setAliases (const QVariantList &value)
 Replaces editable property aliases.
QString aliasInputText () const
 Returns the current alias input text.
void setAliasInputText (const QString &value)
 Updates the current alias input text.
int aliasIndex () const
 Returns the selected alias index.
void setAliasIndex (int value)
 Updates the selected alias index.
QVariantList selectedContractIds () const
 Returns selected contract ids in the property form.
void setSelectedContractIds (const QVariantList &value)
 Replaces selected contract ids in the property form.
bool isEdit () const
 Checks whether the form edits an existing property.
bool hasChanges () const
 Checks whether the editable form differs from the loaded property.
bool canSubmit () const
 Checks whether the form has enough UI data to submit.
QVariantList propertyRows () const
 Returns property sidebar rows.
QVariantList contractRows () const
 Returns selectable contract rows for the property form.
Q_INVOKABLE void selectProperty (const QString &id)
 Selects a property for editing.
Q_INVOKABLE bool canAddAlias (const QString &value) const
 Checks whether an alias value can be added to the form.
Q_INVOKABLE void addAlias (const QString &value)
 Adds an alias to the property form.
Q_INVOKABLE void requestRemoveSelectedAlias ()
 Removes the currently selected alias when possible.
Q_INVOKABLE void enterCreateMode ()
 Clears selection and opens an empty create form.
Q_INVOKABLE void previous ()
 Selects the previous property row.
Q_INVOKABLE void next ()
 Selects the next property row.
Q_INVOKABLE QString submit ()
 Creates or updates the property through workspace commands.
Q_INVOKABLE void deleteCurrent ()
 Deletes the selected property through workspace commands.
Q_INVOKABLE void clear ()
 Clears the editable property form.
Q_INVOKABLE void setContractSelected (const QString &contractId, bool selected)
 Adds or removes a contract id from the property form selection.

Properties

QString currentId
QString name
QVariantList aliases
QString aliasInputText
int aliasIndex
QVariantList selectedContractIds
QVariantList propertyRows
QVariantList contractRows
bool isEdit
bool hasChanges
bool canSubmit

Detailed Description

Owns editable property UI state and delegates property CRUD to workspace.

Definition at line 25 of file PropertyViewModel.h.

Constructor & Destructor Documentation

◆ PropertyViewModel()

ui::PropertyViewModel::PropertyViewModel ( WorkspaceStore * store,
WorkspaceCommands * commands,
WorkspaceSelection * selection,
WorkspaceSelectors * selectors,
QObject * parent = nullptr )
explicit

Creates the property view model bound to workspace roles.

Parameters
parentOptional QObject parent.

Definition at line 260 of file PropertyViewModel.cpp.

Member Function Documentation

◆ addAlias()

void ui::PropertyViewModel::addAlias ( const QString & value)

Adds an alias to the property form.

Parameters
valueAlias text to add.

Definition at line 338 of file PropertyViewModel.cpp.

Here is the call graph for this function:

◆ aliases()

QVariantList ui::PropertyViewModel::aliases ( ) const
inline

Returns editable property aliases.

Returns
Current alias list.

Definition at line 72 of file PropertyViewModel.h.

◆ aliasIndex()

int ui::PropertyViewModel::aliasIndex ( ) const
inline

Returns the selected alias index.

Returns
Selected alias index, or -1 when no alias is selected.

Definition at line 96 of file PropertyViewModel.h.

◆ aliasInputText()

QString ui::PropertyViewModel::aliasInputText ( ) const
inline

Returns the current alias input text.

Returns
Current alias input text.

Definition at line 84 of file PropertyViewModel.h.

◆ canAddAlias()

bool ui::PropertyViewModel::canAddAlias ( const QString & value) const

Checks whether an alias value can be added to the form.

Parameters
valueAlias text to inspect.
Returns
true when the alias text is not blank.

Definition at line 330 of file PropertyViewModel.cpp.

◆ canSubmit()

bool ui::PropertyViewModel::canSubmit ( ) const

Checks whether the form has enough UI data to submit.

Returns
true when the property name field is not blank.

Definition at line 318 of file PropertyViewModel.cpp.

◆ changed

void ui::PropertyViewModel::changed ( )
signal

Emitted when property view model state changed.

Here is the caller graph for this function:

◆ clear()

void ui::PropertyViewModel::clear ( )

Clears the editable property form.

Definition at line 411 of file PropertyViewModel.cpp.

◆ contractRows()

QVariantList ui::PropertyViewModel::contractRows ( ) const

Returns selectable contract rows for the property form.

Returns
QML-ready contract rows from workspace selectors.

Definition at line 433 of file PropertyViewModel.cpp.

◆ currentId()

QString ui::PropertyViewModel::currentId ( ) const

Returns the currently selected property id.

Returns
Selected property id, or an empty string in create mode.

Definition at line 425 of file PropertyViewModel.cpp.

◆ deleteCurrent()

void ui::PropertyViewModel::deleteCurrent ( )

Deletes the selected property through workspace commands.

Definition at line 398 of file PropertyViewModel.cpp.

Here is the call graph for this function:

◆ enterCreateMode()

void ui::PropertyViewModel::enterCreateMode ( )

Clears selection and opens an empty create form.

Definition at line 353 of file PropertyViewModel.cpp.

◆ hasChanges()

bool ui::PropertyViewModel::hasChanges ( ) const

Checks whether the editable form differs from the loaded property.

Returns
true when the create form is submittable or an edit changed.

Definition at line 322 of file PropertyViewModel.cpp.

◆ isEdit()

bool ui::PropertyViewModel::isEdit ( ) const

Checks whether the form edits an existing property.

Returns
true when a property id is selected.

Definition at line 314 of file PropertyViewModel.cpp.

◆ name()

QString ui::PropertyViewModel::name ( ) const
inline

Returns the editable property name.

Returns
Current form name.

Definition at line 60 of file PropertyViewModel.h.

◆ next()

void ui::PropertyViewModel::next ( )

Selects the next property row.

Definition at line 369 of file PropertyViewModel.cpp.

◆ previous()

void ui::PropertyViewModel::previous ( )

Selects the previous property row.

Definition at line 360 of file PropertyViewModel.cpp.

◆ propertyRows()

QVariantList ui::PropertyViewModel::propertyRows ( ) const

Returns property sidebar rows.

Returns
QML-ready property rows from workspace selectors.

Definition at line 429 of file PropertyViewModel.cpp.

◆ requestRemoveSelectedAlias()

void ui::PropertyViewModel::requestRemoveSelectedAlias ( )

Removes the currently selected alias when possible.

Definition at line 345 of file PropertyViewModel.cpp.

Here is the call graph for this function:

◆ selectedContractIds()

QVariantList ui::PropertyViewModel::selectedContractIds ( ) const
inline

Returns selected contract ids in the property form.

Returns
Selected contract ids.

Definition at line 108 of file PropertyViewModel.h.

◆ selectProperty()

void ui::PropertyViewModel::selectProperty ( const QString & id)

Selects a property for editing.

Parameters
idProperty id selected by the QML sidebar.

Definition at line 443 of file PropertyViewModel.cpp.

◆ setAliases()

void ui::PropertyViewModel::setAliases ( const QVariantList & value)

Replaces editable property aliases.

Parameters
valueNew alias list.

Definition at line 279 of file PropertyViewModel.cpp.

Here is the call graph for this function:

◆ setAliasIndex()

void ui::PropertyViewModel::setAliasIndex ( int value)

Updates the selected alias index.

Parameters
valueNew selected alias index.

Definition at line 298 of file PropertyViewModel.cpp.

Here is the call graph for this function:

◆ setAliasInputText()

void ui::PropertyViewModel::setAliasInputText ( const QString & value)

Updates the current alias input text.

Parameters
valueNew alias input text.

Definition at line 290 of file PropertyViewModel.cpp.

Here is the call graph for this function:

◆ setContractSelected()

void ui::PropertyViewModel::setContractSelected ( const QString & contractId,
bool selected )

Adds or removes a contract id from the property form selection.

Parameters
contractIdContract id to toggle.
selectedWhether the contract should be selected.

Definition at line 417 of file PropertyViewModel.cpp.

Here is the call graph for this function:

◆ setName()

void ui::PropertyViewModel::setName ( const QString & value)

Updates the editable property name.

Parameters
valueNew form name.

Definition at line 271 of file PropertyViewModel.cpp.

Here is the call graph for this function:

◆ setSelectedContractIds()

void ui::PropertyViewModel::setSelectedContractIds ( const QVariantList & value)

Replaces selected contract ids in the property form.

Parameters
valueNew selected contract ids.

Definition at line 306 of file PropertyViewModel.cpp.

Here is the call graph for this function:

◆ submit()

QString ui::PropertyViewModel::submit ( )

Creates or updates the property through workspace commands.

Returns
Saved property id, or an empty string when submission fails.

Definition at line 378 of file PropertyViewModel.cpp.

Here is the call graph for this function:

Property Documentation

◆ aliases

QVariantList ui::PropertyViewModel::aliases
readwrite

Definition at line 29 of file PropertyViewModel.h.

◆ aliasIndex

int ui::PropertyViewModel::aliasIndex
readwrite

Definition at line 32 of file PropertyViewModel.h.

◆ aliasInputText

QString ui::PropertyViewModel::aliasInputText
readwrite

Definition at line 30 of file PropertyViewModel.h.

◆ canSubmit

bool ui::PropertyViewModel::canSubmit
read

Definition at line 39 of file PropertyViewModel.h.

◆ contractRows

QVariantList ui::PropertyViewModel::contractRows
read

Definition at line 36 of file PropertyViewModel.h.

◆ currentId

QString ui::PropertyViewModel::currentId
read

Definition at line 27 of file PropertyViewModel.h.

◆ hasChanges

bool ui::PropertyViewModel::hasChanges
read

Definition at line 38 of file PropertyViewModel.h.

◆ isEdit

bool ui::PropertyViewModel::isEdit
read

Definition at line 37 of file PropertyViewModel.h.

◆ name

QString ui::PropertyViewModel::name
readwrite

Definition at line 28 of file PropertyViewModel.h.

◆ propertyRows

QVariantList ui::PropertyViewModel::propertyRows
read

Definition at line 35 of file PropertyViewModel.h.

◆ selectedContractIds

QVariantList ui::PropertyViewModel::selectedContractIds
read

Definition at line 33 of file PropertyViewModel.h.


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