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

Tree model for the portfolio/book hierarchy. More...

#include <PortfolioExplorerTreeModel.hpp>

Inherits QAbstractItemModel.

Collaboration diagram for PortfolioExplorerTreeModel:
Collaboration graph

Public Member Functions

 PortfolioExplorerTreeModel (QObject *parent=nullptr)
 
void load (const QString &party_name, std::vector< refdata::domain::portfolio > portfolios, std::vector< refdata::domain::book > books)
 Rebuild the tree from raw portfolio and book data.
 
TreeNodeFilter 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.
 
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
 
PortfolioTreeNodenode_from_index (const QModelIndex &index) const
 Returns the node for a given index, or nullptr if invalid.
 

Detailed Description

Tree model for the portfolio/book hierarchy.

The top-level item is always the owning party node. Real portfolios are inner nodes and books are leaves. Virtual portfolios (is_virtual == 1) are included as structural parents distinguished by the outline Briefcase icon.

Member Function Documentation

◆ load()

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

Rebuild the tree from raw portfolio and book data.

Creates a single party root node named party_name, then adds portfolios and books beneath it. Books are placed as leaves under their parent_portfolio_id.

◆ selected_filter()

TreeNodeFilter selected_filter ( const QModelIndex &  index) const

Returns the filter for the selected index.

For a book node: sets book_id. For a portfolio node: sets portfolio_id. For a party node: returns nullopt pair (show all trades). Returns nullopt pair if index is invalid.

◆ 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 updates to show "(N)".