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

Shows the record of hierarchy and allows selecting one or more records. More...

#include <recordtreewidget.h>

Inheritance diagram for Tome::RecordTreeWidget:

Signals

void progressChanged (const QString title, const QString text, const int currentValue, const int maximumValue) const
 Progress of the current record operation has changed. More...
 
void recordReparented (const QVariant &recordId, const QVariant &newParentId)
 A record has been reparented to another record in the hierarchy. More...
 

Public Member Functions

 RecordTreeWidget (RecordsController &recordsController, FacetsController &facetsController, FieldDefinitionsController &fieldDefinitionsController, ProjectController &projectController, SettingsController &settingsController)
 Constructs a new widget that shows the record of hierarchy and allows selecting one or more records. More...
 
void addRecord (const QVariant &id, const QString &displayName, const QVariant &parentId)
 Adds the specified record to show in the hierarchy. More...
 
QVariant getSelectedRecordId () const
 Gets the id of the currently selected record. More...
 
QVariantList getSelectedRecordIds () const
 Gets a list of ids of all currently selected records. More...
 
void navigateForward ()
 Selects the next record in the history of selected records.
 
void navigateBackward ()
 Selects the previous record in the history of selected records.
 
void updateRecord (const QVariant &oldId, const QString &oldDisplayName, const QString &oldEditorIconFieldId, const QVariant &newId, const QString &newDisplayName, const QString &newEditorIconFieldId)
 Updates the specified record in the hierarchy. More...
 
void selectRecord (const QVariant &id, const bool addToHistory)
 Selects the specified record in the hierarchy. More...
 
void setContextMenuActions (QList< QAction *> actions)
 Sets the list of actions to show in the context menu of the selected records. More...
 
void setRecords (const RecordList &records)
 Sets the records to show in the hierarchy. More...
 
void removeRecord (const QVariant &id)
 Removes the specified record from the hierarchy. More...
 

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *event) Q_DECL_OVERRIDE
 Shows the context menu for the current set of selected records. More...
 
bool dropMimeData (QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) Q_DECL_OVERRIDE
 Checks whether to reparent a record in the hierarchy by drag & drop. More...
 
void mousePressEvent (QMouseEvent *event) Q_DECL_OVERRIDE
 Selects a record in the hierarchy, or clears the current selection. More...
 

Detailed Description

Shows the record of hierarchy and allows selecting one or more records.

Constructor & Destructor Documentation

◆ RecordTreeWidget()

RecordTreeWidget::RecordTreeWidget ( RecordsController recordsController,
FacetsController facetsController,
FieldDefinitionsController fieldDefinitionsController,
ProjectController projectController,
SettingsController settingsController 
)

Constructs a new widget that shows the record of hierarchy and allows selecting one or more records.

Parameters
recordsControllerController for adding, updating and removing records.
facetsControllerController for validating type facets.
fieldDefinitionsControllerController for adding, updating and removing field definitions.
projectControllerController for creating, loading and saving projects.
settingsControllerController for accessing user settings.

Member Function Documentation

◆ addRecord()

void RecordTreeWidget::addRecord ( const QVariant &  id,
const QString &  displayName,
const QVariant &  parentId 
)

Adds the specified record to show in the hierarchy.

Parameters
idId of the record to add.
displayNameDisplay name of the record to show in the hierarchy.
parentIdId of the record to parent the new record to in the hierarchy.

◆ contextMenuEvent()

void RecordTreeWidget::contextMenuEvent ( QContextMenuEvent *  event)
protected

Shows the context menu for the current set of selected records.

Parameters
eventEvent for showing the context menu.

◆ dropMimeData()

bool RecordTreeWidget::dropMimeData ( QTreeWidgetItem *  parent,
int  index,
const QMimeData *  data,
Qt::DropAction  action 
)
protected

Checks whether to reparent a record in the hierarchy by drag & drop.

Parameters
parentNew parent to reparent the dragged record to.
indexUnused.
dataDragged record.
actionUnused.
Returns
True, if a record has been dragged & dropped onto another one, and false otherwise.

◆ getSelectedRecordId()

QVariant RecordTreeWidget::getSelectedRecordId ( ) const

Gets the id of the currently selected record.

Returns
Id of the currently selected record, or null if no record is selected.

◆ getSelectedRecordIds()

QVariantList RecordTreeWidget::getSelectedRecordIds ( ) const

Gets a list of ids of all currently selected records.

Returns
List of ids of all currently selected records, or an empty list if no record is selected.

◆ mousePressEvent()

void RecordTreeWidget::mousePressEvent ( QMouseEvent *  event)
protected

Selects a record in the hierarchy, or clears the current selection.

Parameters
eventEvent to selecting a record in the hierarchy or clearing the selection.

◆ progressChanged

void Tome::RecordTreeWidget::progressChanged ( const QString  title,
const QString  text,
const int  currentValue,
const int  maximumValue 
) const
signal

Progress of the current record operation has changed.

Parameters
titleTitle of the current record operation step.
textDetails of the current record operation step.
currentValueCurrent progress value of the current record operation step.
maximumValueMaximum progress value of the current record operation step.

◆ recordReparented

void Tome::RecordTreeWidget::recordReparented ( const QVariant &  recordId,
const QVariant &  newParentId 
)
signal

A record has been reparented to another record in the hierarchy.

Parameters
recordIdId of the record which has been reparented.
newParentIdId of the new parent of the record, or null if the record has been made a root of the hierarchy.

◆ removeRecord()

void RecordTreeWidget::removeRecord ( const QVariant &  id)

Removes the specified record from the hierarchy.

Parameters
idId of the record to remove.

◆ selectRecord()

void RecordTreeWidget::selectRecord ( const QVariant &  id,
const bool  addToHistory 
)

Selects the specified record in the hierarchy.

Parameters
idId of the record to select.
addToHistoryWhether to add the record to the navigation history, or not.

◆ setContextMenuActions()

void RecordTreeWidget::setContextMenuActions ( QList< QAction *>  actions)

Sets the list of actions to show in the context menu of the selected records.

Parameters
actionsList of actions to show in the context menu of the selected records.

◆ setRecords()

void RecordTreeWidget::setRecords ( const RecordList &  records)

Sets the records to show in the hierarchy.

Parameters
recordsRecords to show in the hierarchy.

◆ updateRecord()

void RecordTreeWidget::updateRecord ( const QVariant &  oldId,
const QString &  oldDisplayName,
const QString &  oldEditorIconFieldId,
const QVariant &  newId,
const QString &  newDisplayName,
const QString &  newEditorIconFieldId 
)

Updates the specified record in the hierarchy.

Parameters
oldIdPrevious id of the record to update.
oldDisplayNamePrevious display name of the record to update to show in the hierarchy.
oldEditorIconFieldIdPrevious id of the field to use as editor icon for the record to update.
newIdNew id of the record to update.
newDisplayNameNew display name of the record to update to show in the hierarchy.
newEditorIconFieldIdNew id of the field to use as editor icon for the record to update.

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