Commit bcc14a79 by Alisa Jung

still compiling

parent 18280c79
...@@ -242,6 +242,12 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -242,6 +242,12 @@ MainWindow::MainWindow(QWidget *parent)
connect(deletePrimitive, SIGNAL(triggered(bool)),controller, SLOT(deletePrimitive())); connect(deletePrimitive, SIGNAL(triggered(bool)),controller, SLOT(deletePrimitive()));
deletePrimitive->setShortcut(QKeySequence(Qt::Key_Delete)); deletePrimitive->setShortcut(QKeySequence(Qt::Key_Delete));
treeView = new QTreeView(this);
treeView->setModel(controller->getSceneGraph()->getModel());
treeView->expandAll();
} }
......
...@@ -16,7 +16,9 @@ ...@@ -16,7 +16,9 @@
#include <controller.h> #include <controller.h>
#include <QLayout> #include <QLayout>
#include <QSplitter> #include <QSplitter>
#include <QTreeView>
#include <scenegraph.h>
#include <myitemmodel.h>
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
{ {
Q_OBJECT Q_OBJECT
...@@ -87,6 +89,8 @@ private: ...@@ -87,6 +89,8 @@ private:
QAction* deletePrimitive; QAction* deletePrimitive;
QTreeView* treeView;
public slots : public slots :
void showAboutBox ( ) ; void showAboutBox ( ) ;
}; };
......
...@@ -13,6 +13,7 @@ SceneGraph::SceneGraph() ...@@ -13,6 +13,7 @@ SceneGraph::SceneGraph()
coneIndex = 1; coneIndex = 1;
torusIndex = 1; torusIndex = 1;
model = new MyItemModel;
} }
//Scenegraph gets a list of all views it needs to notify on changes //Scenegraph gets a list of all views it needs to notify on changes
...@@ -20,6 +21,10 @@ void SceneGraph::registerView(MyGLWidget* view){ ...@@ -20,6 +21,10 @@ void SceneGraph::registerView(MyGLWidget* view){
views.append(view); views.append(view);
} }
MyItemModel* SceneGraph::getModel(){
return model;
}
//add primitives to sceneGraph //add primitives to sceneGraph
RigidBodyTransformation* SceneGraph::addSphere(int tesselation){ RigidBodyTransformation* SceneGraph::addSphere(int tesselation){
nextSphereName = "Sphere "; nextSphereName = "Sphere ";
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <QList> #include <QList>
#include <rigidbodytransformation.h> #include <rigidbodytransformation.h>
#include <QString> #include <QString>
#include <myitemmodel.h>
class MyGLWidget; class MyGLWidget;
...@@ -30,6 +31,9 @@ public: ...@@ -30,6 +31,9 @@ public:
//automatically selects last added primitive. if none left, selects 0. //automatically selects last added primitive. if none left, selects 0.
RigidBodyTransformation* deleteNode(RigidBodyTransformation* r); RigidBodyTransformation* deleteNode(RigidBodyTransformation* r);
MyItemModel* getModel();
//Hallo. Todos: //Hallo. Todos:
//Log selected name in status bar //Log selected name in status bar
//add remaining primitive types //add remaining primitive types
...@@ -56,6 +60,9 @@ private: ...@@ -56,6 +60,9 @@ private:
QList<MyGLWidget*> views; QList<MyGLWidget*> views;
MyItemModel* model;
}; };
#endif // SCENEGRAPH_H #endif // SCENEGRAPH_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment