32 if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
34 if (section <
data.size())
35 return data.at(section);
55 throw std::runtime_error(
"Error in ViewModel: atttemp to set nulptr as root item");
73 QModelIndexList result;
The main object representing an editable/displayable/serializable entity.
Main class to hold hierarchy of SessionItem objects.
Represents the view of SessionItem's data in a single cell of ViewModel.
SessionItem * item() const
Base class for all view models to show content of SessionModel in Qt views.
ViewItem * rootItem() const
Returns a pointer to invisible root item.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QModelIndex indexFromItem(const ViewItem *item) const
Returns the QModelIndex associated with the given item.
ViewItem * itemFromIndex(const QModelIndex &index) const
Returns a pointer to the RefViewItem associated with the given index.
SessionModel * sessionModel() const
QModelIndexList indexOfSessionItem(const SessionItem *item) const
Returns list of model indices representing given SessionItem.
ViewItem * viewItemFromIndex(const QModelIndex &index) const
void setRootSessionItem(SessionItem *item)
SessionItem * sessionItemFromIndex(const QModelIndex &index) const
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
ViewModel(std::unique_ptr< ViewModelController > controller, QObject *parent=nullptr)
std::unique_ptr< ViewModelController > m_controller
std::vector< ViewItem * > findViews(const ModelView::SessionItem *item) const
Returns vector of all ViewItem's representing given SessionItem.
SessionItem * rootSessionItem()
materialitems.h Collection of materials to populate MaterialModel.