ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Member Functions | List of all members
OrgExplorerTreeModel Class Referencefinal

Tree model for the organisational hierarchy. More...

#include <OrgExplorerTreeModel.hpp>

Inherits QAbstractItemModel.

Collaboration diagram for OrgExplorerTreeModel:
Collaboration graph

Public Member Functions

 OrgExplorerTreeModel (QObject *parent=nullptr)
 
void load (const QString &party_name, std::vector< refdata::domain::business_unit > units, std::vector< refdata::domain::book > books)
 Rebuild the tree from raw business unit and book data.
 
OrgTreeNodeFilter selected_filter (const QModelIndex &index) const
 Returns the filter for the selected index.
 
void set_trade_count (const boost::uuids::uuid &book_id, std::uint32_t count)
 Update the trade count for a book and refresh its display.
 
OrgTreeNodenode_from_index (const QModelIndex &index) const
 Returns the node for a given index, or nullptr if invalid.
 
QModelIndex index (int row, int col, const QModelIndex &parent=QModelIndex()) const override
 
QModelIndex parent (const QModelIndex &index) const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 

Detailed Description

Tree model for the organisational hierarchy.

Displays: Party root → BusinessUnit nodes (recursive via parent_business_unit_id) → Book leaves (via owner_unit_id).

Books with no owner_unit_id are placed under an "Unassigned" synthetic node at the party level.

Member Function Documentation

◆ load()

void load ( const QString &  party_name,
std::vector< refdata::domain::business_unit units,
std::vector< refdata::domain::book books 
)

Rebuild the tree from raw business unit and book data.

Creates a single party root node named party_name, then adds business units recursively and books as leaves under their owning unit. Books with no owner_unit_id are grouped under an "Unassigned" node.

◆ selected_filter()

OrgTreeNodeFilter selected_filter ( const QModelIndex &  index) const

Returns the filter for the selected index.

For a book node: sets book_id. For a BusinessUnit node: sets business_unit_id. For a party node: returns nullopt pair (show all trades).

◆ set_trade_count()

void set_trade_count ( const boost::uuids::uuid &  book_id,
std::uint32_t  count 
)

Update the trade count for a book and refresh its display.

Called after background count fetches complete. Stores the count and emits dataChanged so the book label and all ancestor labels update.