From f928869357765e3a73501064408bb7bc0ee363ef Mon Sep 17 00:00:00 2001 From: Treeki Date: Wed, 5 Sep 2012 01:36:57 +0200 Subject: improving the material editor --- lslayoutwindow.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lslayoutwindow.cpp') diff --git a/lslayoutwindow.cpp b/lslayoutwindow.cpp index 38e0417..3323803 100644 --- a/lslayoutwindow.cpp +++ b/lslayoutwindow.cpp @@ -1,5 +1,6 @@ #include "lslayoutwindow.h" #include "lsscenemodel.h" +#include "lsmaterialmodel.h" #include "lspaneeditor.h" #include "lsmaterialeditor.h" #include "layoutgl/widget.h" @@ -123,6 +124,12 @@ LSLayoutWindow::LSLayoutWindow(LYTPackageBase *pkg, const QString &layoutName, Q m_sceneGraph->expandAll(); connect(m_sceneGraph->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(selectedPaneChanged(QModelIndex,QModelIndex))); + LSMaterialModel *matModel = new LSMaterialModel(&m_layout->materials, this); + + m_materialList->setSelectionMode(QAbstractItemView::SingleSelection); + m_materialList->setModel(matModel); + connect(m_materialList->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(selectedMaterialChanged(QModelIndex,QModelIndex))); + setWindowTitle(m_layoutName); @@ -161,7 +168,10 @@ void LSLayoutWindow::selectedPaneChanged(const QModelIndex ¤t, const QMode } void LSLayoutWindow::selectedMaterialChanged(const QModelIndex ¤t, const QModelIndex &previous) { + (void)previous; + LYTMaterial *mat = m_layout->materials.getMaterialByIndex(current.row()); + m_materialEditor->setMaterial(mat); } -- cgit v1.2.3