19 #include <QVBoxLayout>
25 , m_treeView(new QTreeView)
27 , m_block_selection(false)
29 auto layout =
new QVBoxLayout;
31 layout->setSpacing(0);
60 auto indexes =
m_viewModel->indexOfSessionItem(item);
62 selectionModel()->select(indexes.at(0), QItemSelectionModel::SelectCurrent);
84 auto indexes =
m_treeView->selectionModel()->selectedIndexes();
85 if (!indexes.empty()) {
86 auto item =
m_viewModel->sessionItemFromIndex(indexes.at(0));
98 connect(
selectionModel(), &QItemSelectionModel::selectionChanged,
this,
101 disconnect(
selectionModel(), &QItemSelectionModel::selectionChanged,
this,
void setRootSessionItem(SessionItem *item)
std::unique_ptr< ViewModelDelegate > m_delegate
std::unique_ptr< ViewModel > m_viewModel
void setViewModelDelegate(std::unique_ptr< ViewModelDelegate > delegate)
QItemSelectionModel * selectionModel()
void set_connected(bool flag)
void onSelectionChanged(const QItemSelection &, const QItemSelection &)
Processes selections in QTreeView.
void setViewModel(std::unique_ptr< ViewModel > viewModel)
void itemSelected(ModelView::SessionItem *)
void setSelected(SessionItem *item)
Make given item selected in QTreeView.
ItemsTreeView(QWidget *parent=nullptr)
ViewModel * viewModel() const
~ItemsTreeView() override
The main object representing an editable/displayable/serializable entity.
Model delegate to provide editing/painting for custom variants.
Main class to represent content of SessionModel in Qt's trees and tables.
materialitems.h Collection of materials to populate MaterialModel.