24 #include <QVBoxLayout>
28 , m_materialModel(materialModel)
30 , m_splitter(new QSplitter)
31 , m_listView(new QListView)
33 , m_model_was_modified(false)
35 setWindowTitle(
"MaterialEditorWidget");
36 setMinimumSize(128, 128);
38 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
40 QVBoxLayout* layout =
new QVBoxLayout;
41 layout->setContentsMargins(0, 0, 0, 0);
74 QItemSelectionModel::ClearAndSelect);
76 QItemSelectionModel::ClearAndSelect);
87 QModelIndexList indices = selected.indexes();
89 if (indices.isEmpty()) {
124 m_listView->setContextMenuPolicy(Qt::CustomContextMenu);
133 connect(
selectionModel(), &QItemSelectionModel::selectionChanged,
this,
139 selectionModel()->select(itemIndex, QItemSelectionModel::ClearAndSelect);
#define ASSERT(condition)
Defines ComponentEditor class.
Defines class ExternalProperty.
Defines class MaterialEditor.
Defines class MaterialItem.
Defines class MaterialModel.
Defines class SessionDecorationModel.
Component editor for SessionItem.
void setItem(SessionItem *item)
The ExternalProperty class defines custom QVariant property to carry the text, color and an identifie...
QString identifier() const
MaterialModel * m_materialModel
bool modelWasChanged() const
MaterialItem * selectedMaterial()
void onDataChanged(const QModelIndex &, const QModelIndex &, const QVector< int > &)
void onRowsInserted(const QModelIndex &, int, int)
void contextMenuEvent(QContextMenuEvent *event)
Context menu reimplemented to supress default menu.
MaterialEditorToolBar * m_toolBar
bool m_model_was_modified
void onSelectionChanged(const QItemSelection &selected, const QItemSelection &)
QItemSelectionModel * selectionModel()
ComponentEditor * m_componentEditor
MaterialEditor(MaterialModel *materialModel, QWidget *parent=nullptr)
void setInitialMaterialProperty(const ExternalProperty &matProperty)
Sets selection corresponding to initial material property.
void onRowsRemoved(const QModelIndex &, int, int)
MaterialItem * materialFromIndex(const QModelIndex &index)
MaterialItem * materialFromIdentifier(const QString &identifier)
Provides decorations (text color, icons, etc) for SessionModel in SessionModelView context.
SessionItem * itemForIndex(const QModelIndex &index) const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
QModelIndex indexOfItem(SessionItem *item) const