23 : QItemSelectionModel(view_model, parent)
26 connect(view_model, &ModelView::ViewModel::modelAboutToBeReset, [
this]() { clearSelection(); });
36 QModelIndexList indexes;
37 for (
auto item : items)
45 QItemSelection selection(indexes.front(), indexes.back());
46 auto flags = QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows;
47 select(selection, flags);
54 std::vector<MaterialBaseItem*> result;
56 std::transform(std::begin(selected_items), std::end(selected_items), std::back_inserter(result),
The main object representing an editable/displayable/serializable entity.
Main class to represent content of SessionModel in Qt's trees and tables.
QModelIndexList indexOfSessionItem(const SessionItem *item) const
Returns list of model indices representing given SessionItem.
Base class with all materials with name and color defined.
static const std::string P_NAME
void selectItems(std::vector< ModelView::SessionItem * > items)
const ModelView::ViewModel * viewModel() const
void selectItem(ModelView::SessionItem *item)
std::vector< MaterialBaseItem * > selectedMaterials() const
Returns vector of selected materials.
MaterialSelectionModel(ModelView::ViewModel *view_model, QObject *parent=nullptr)
MVVM_VIEWMODEL_EXPORT std::vector< SessionItem * > ParentItemsFromIndex(const QModelIndexList &index_list)
Returns vector of parent items from given index list.
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.