NDEVR
API Documentation
DesignPropertyTable

A base class for tables wishing to show columns of DesignObject properties. More...

Inheritance diagram for DesignPropertyTable:
[legend]
Collaboration diagram for DesignPropertyTable:
[legend]

Public Member Functions

 DesignPropertyTable (QTModelManager *manager, QWidget *parent=nullptr)
 Constructs a DesignPropertyTable with a model manager.
 DesignPropertyTable (QWidget *parent=nullptr)
 Constructs a DesignPropertyTable without a model manager.
uint04 addColumn (const DesignParameter &parameter, bool is_editable=true)
 Adds a column displaying the given design parameter.
uint04 addColumn (const ModelTableColumnSpec &column)
 Adds a column from a fully specified ModelTableColumnSpec.
uint04 addColumn (const TranslatedString &custom_column_name, const DesignParameter &parameter, bool is_editable=true)
 Adds a column with a custom name displaying the given design parameter.
uint04 addColumn (const TranslatedString &name, const StringView &icon, const std::function< void(UUID)> &callback)
 Adds a button column with a custom icon and click callback.
uint04 addColumn (NDPO property, bool is_editable=true)
 Adds a column displaying the given NDPO property.
void addListItem (const UUID &id)
 Adds a single object to the table.
uint04 addMaterialDataColumn (const TranslatedString &custom_column_name=TranslatedString())
 Adds a column showing material data for each design object.
ButtonaddNewButton (std::function< void(Button *)> callback, const TranslatedString &new_title=_t("Add New"), const StringView &add_icon="plus")
 Adds an "Add New" button to the bottom button bar.
void addOpenButton (std::function< void(Button *)> callback, const TranslatedString &new_title=_t("Open"), const StringView &add_icon="open")
 Adds an "Open" button to the bottom button bar.
uint04 addParentPathColumn (const TranslatedString &custom_column_name=TranslatedString())
 Adds a column showing the parent path of each design object.
void addWidget (QWidget *widget)
 Adds a custom widget to the bottom button bar.
bool event (QEvent *event) override
 Handles events, including custom polish events for deferred setup.
void filterAndSetList (Buffer< UUID > ids)
 Applies the current search filter and sets the list of objects to display.
bool isEditable ()
 Returns whether the table is currently editable.
const std::function< void(Model, PopupInfo)> & selectedCallback () const
 Returns the current selection callback.
Buffer< UUIDselectedIDs () const
 Returns the UUIDs of the currently selected rows.
void setAddedFilter (const std::function< bool(const Model &)> &callback)
 Sets a custom filter callback applied when objects are added.
void setColumnEditable (uint04 column, bool editable)
 Sets whether a specific column is editable.
void setColumnVisible (uint04 column, bool visible)
 Shows or hides a specific column.
void setEditable (bool editable)
 Sets whether the entire table is editable.
void setList (const Buffer< UUID > &ids)
 Sets the list of objects to display in the table.
virtual void setModelManager (QTModelManager *manager)
 Sets the model manager and connects it to the table model.
void setModels (const Buffer< Model > &models)
 Sets the table contents from a buffer of Models.
void setSelectedCallback (const std::function< void(Model, PopupInfo)> &callback)
 Sets the callback invoked when a row is selected.
void setSortCallback (const std::function< bool(const Model &a, const Model &b)> &callback)
 Sets a custom sort comparison callback for ordering rows.
void setTypeAddedFilter (const String &type)
 Sets a type-based filter so only objects of the given type appear when added.
void setup ()
 Performs initial setup of the table layout, search bar, and edit button.
void setupTable ()
 Sets up the table view, proxy model, and delegate.
void showSearch (bool show_search)
 Shows or hides the search bar.
void updateRow (uint04 row)
 Updates the data display for a specific row.
void viewSettingsSignal ()
 Emitted when the view settings should be shown or updated.

Protected Member Functions

void contextMenu (const QPoint &pos)
 Slot called to display a context menu at the given position.
void selected (QModelIndex index)
 Slot called when a table row is selected.

Protected Attributes

QHBoxLayout * m_bottom_button_layout
 The layout for buttons at the bottom of the table.
Buttonm_edit_button
 The button for toggling edit mode.
QTModelManagerm_manager
 The model manager providing design objects.
DesignObjectSearchWidgetm_search_text
 The search text input widget.
QWidget * m_search_widget
 The container widget for the search bar.
DesignSortFilterProxyModelm_sort_model
 The sort/filter proxy model.
DesignPropertyTableViewm_table_view
 The table view displaying design object properties.
DesignTableModelm_view_model
 The underlying table model.

Detailed Description

A base class for tables wishing to show columns of DesignObject properties.


Definition at line 143 of file DesignPropertyTable.h.

Constructor & Destructor Documentation

◆ DesignPropertyTable() [1/2]

DesignPropertyTable::DesignPropertyTable ( QWidget * parent = nullptr)
explicit

Constructs a DesignPropertyTable without a model manager.

Parameters
[in]parentThe parent widget.

Referenced by DesignPropertyTable(), ModelTileTable::ModelTileTable(), and ModelTileTable::ModelTileTable().

◆ DesignPropertyTable() [2/2]

DesignPropertyTable::DesignPropertyTable ( QTModelManager * manager,
QWidget * parent = nullptr )
explicit

Constructs a DesignPropertyTable with a model manager.

Parameters
[in]managerThe QTModelManager providing design objects.
[in]parentThe parent widget.

References DesignPropertyTable().

Member Function Documentation

◆ addColumn() [1/5]

uint04 DesignPropertyTable::addColumn ( const DesignParameter & parameter,
bool is_editable = true )

Adds a column displaying the given design parameter.

Parameters
[in]parameterThe design parameter to display.
[in]is_editableWhether the column allows editing.
Returns
The index of the added column.

◆ addColumn() [2/5]

uint04 DesignPropertyTable::addColumn ( const ModelTableColumnSpec & column)

Adds a column from a fully specified ModelTableColumnSpec.

Parameters
[in]columnThe column specification.
Returns
The index of the added column.

◆ addColumn() [3/5]

uint04 DesignPropertyTable::addColumn ( const TranslatedString & custom_column_name,
const DesignParameter & parameter,
bool is_editable = true )

Adds a column with a custom name displaying the given design parameter.

Parameters
[in]custom_column_nameThe column header name.
[in]parameterThe design parameter to display.
[in]is_editableWhether the column allows editing.
Returns
The index of the added column.

◆ addColumn() [4/5]

uint04 DesignPropertyTable::addColumn ( const TranslatedString & name,
const StringView & icon,
const std::function< void(UUID)> & callback )

Adds a button column with a custom icon and click callback.

Parameters
[in]nameThe column header name.
[in]iconThe icon name for the button.
[in]callbackThe function called with the object UUID when clicked.
Returns
The index of the added column.

◆ addColumn() [5/5]

uint04 DesignPropertyTable::addColumn ( NDPO property,
bool is_editable = true )

Adds a column displaying the given NDPO property.

Parameters
[in]propertyThe design object property.
[in]is_editableWhether the column allows editing.
Returns
The index of the added column.

Referenced by ModelTileTable::init().

◆ addListItem()

void DesignPropertyTable::addListItem ( const UUID & id)

Adds a single object to the table.

Parameters
[in]idThe UUID of the object to add.

◆ addMaterialDataColumn()

uint04 DesignPropertyTable::addMaterialDataColumn ( const TranslatedString & custom_column_name = TranslatedString())

Adds a column showing material data for each design object.

Parameters
[in]custom_column_nameAn optional custom column header name.
Returns
The index of the added column.

◆ addNewButton()

Button * DesignPropertyTable::addNewButton ( std::function< void(Button *)> callback,
const TranslatedString & new_title = _t("Add New"),
const StringView & add_icon = "plus" )

Adds an "Add New" button to the bottom button bar.

Parameters
[in]callbackThe function called when the button is clicked.
[in]new_titleThe button label.
[in]add_iconThe icon name for the button.
Returns
A pointer to the created Button.

Referenced by TransitIncidentVehiclesEditor::TransitIncidentVehiclesEditor(), and ModelTileTable::init().

◆ addOpenButton()

void DesignPropertyTable::addOpenButton ( std::function< void(Button *)> callback,
const TranslatedString & new_title = _t("Open"),
const StringView & add_icon = "open" )

Adds an "Open" button to the bottom button bar.

Parameters
[in]callbackThe function called when the button is clicked.
[in]new_titleThe button label.
[in]add_iconThe icon name for the button.

◆ addParentPathColumn()

uint04 DesignPropertyTable::addParentPathColumn ( const TranslatedString & custom_column_name = TranslatedString())

Adds a column showing the parent path of each design object.

Parameters
[in]custom_column_nameAn optional custom column header name.
Returns
The index of the added column.

◆ addWidget()

void DesignPropertyTable::addWidget ( QWidget * widget)

Adds a custom widget to the bottom button bar.

Parameters
[in]widgetThe widget to add.

◆ contextMenu()

void DesignPropertyTable::contextMenu ( const QPoint & pos)
protected

Slot called to display a context menu at the given position.

Parameters
[in]posThe position in widget coordinates.

◆ event()

bool DesignPropertyTable::event ( QEvent * event)
override

Handles events, including custom polish events for deferred setup.

Parameters
[in]eventThe event to process.
Returns
True if the event was handled.

References event().

Referenced by event().

◆ filterAndSetList()

void DesignPropertyTable::filterAndSetList ( Buffer< UUID > ids)

Applies the current search filter and sets the list of objects to display.

Parameters
[in]idsThe UUIDs of the objects to filter and display.

◆ isEditable()

bool DesignPropertyTable::isEditable ( )

Returns whether the table is currently editable.

Returns
True if the table is editable.

◆ selected()

void DesignPropertyTable::selected ( QModelIndex index)
protected

Slot called when a table row is selected.

Parameters
[in]indexThe model index of the selected row.

◆ selectedCallback()

const std::function< void(Model, PopupInfo)> & DesignPropertyTable::selectedCallback ( ) const
inline

Returns the current selection callback.

Returns
A const reference to the selection callback function.

Definition at line 327 of file DesignPropertyTable.h.

References m_sort_model.

◆ selectedIDs()

Buffer< UUID > DesignPropertyTable::selectedIDs ( ) const

Returns the UUIDs of the currently selected rows.

Returns
A buffer of selected UUIDs.

◆ setAddedFilter()

void DesignPropertyTable::setAddedFilter ( const std::function< bool(const Model &)> & callback)

Sets a custom filter callback applied when objects are added.

Parameters
[in]callbackA function returning true for models that should be included.

Referenced by ModelTileTable::init().

◆ setColumnEditable()

void DesignPropertyTable::setColumnEditable ( uint04 column,
bool editable )

Sets whether a specific column is editable.

Parameters
[in]columnThe column index.
[in]editableWhether editing is allowed for that column.

◆ setColumnVisible()

void DesignPropertyTable::setColumnVisible ( uint04 column,
bool visible )

Shows or hides a specific column.

Parameters
[in]columnThe column index.
[in]visibleWhether the column should be visible.

◆ setEditable()

void DesignPropertyTable::setEditable ( bool editable)

Sets whether the entire table is editable.

Parameters
[in]editableWhether editing is allowed.

Referenced by ModelTileTable::init().

◆ setList()

void DesignPropertyTable::setList ( const Buffer< UUID > & ids)

Sets the list of objects to display in the table.

Parameters
[in]idsThe UUIDs of the objects to display.

◆ setModelManager()

virtual void DesignPropertyTable::setModelManager ( QTModelManager * manager)
virtual

Sets the model manager and connects it to the table model.

Parameters
[in]managerThe QTModelManager instance.

Reimplemented in BuildWorkflowTable, and CustomerJobsList.

◆ setModels()

void DesignPropertyTable::setModels ( const Buffer< Model > & models)

Sets the table contents from a buffer of Models.

Parameters
[in]modelsThe models to display.

Referenced by ModelTileTable::setTarget().

◆ setSelectedCallback()

void DesignPropertyTable::setSelectedCallback ( const std::function< void(Model, PopupInfo)> & callback)
inline

Sets the callback invoked when a row is selected.

Parameters
[in]callbackThe callback receiving the selected Model and popup info.

Definition at line 317 of file DesignPropertyTable.h.

References m_sort_model.

◆ setSortCallback()

void DesignPropertyTable::setSortCallback ( const std::function< bool(const Model &a, const Model &b)> & callback)

Sets a custom sort comparison callback for ordering rows.

Parameters
[in]callbackA comparison function returning true if a should appear before b.

◆ setTypeAddedFilter()

void DesignPropertyTable::setTypeAddedFilter ( const String & type)

Sets a type-based filter so only objects of the given type appear when added.

Parameters
[in]typeThe design object type string to filter on.

◆ showSearch()

void DesignPropertyTable::showSearch ( bool show_search)

◆ updateRow()

void DesignPropertyTable::updateRow ( uint04 row)

Updates the data display for a specific row.

Parameters
[in]rowThe row index to update.

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