Commit 8ece7716 by Kai Westerkamp

grid

parent 0de3f161
...@@ -9,7 +9,7 @@ GLView::GLView(Scene *scene,Camera * camera,Controler *controler ) ...@@ -9,7 +9,7 @@ GLView::GLView(Scene *scene,Camera * camera,Controler *controler )
this->controler = controler; this->controler = controler;
gridSize = 5; gridSize = 5;
gridStepSize = 1; gridStepSize = 1;
isGridEnabled = true; isGridEnabled = false;
} }
QSize GLView::minimumSizeHint() const QSize GLView::minimumSizeHint() const
......
...@@ -23,6 +23,10 @@ protected : ...@@ -23,6 +23,10 @@ protected :
public slots: public slots:
void home(); void home();
void setGridSize(int size){gridSize = size;}
void setGridStepSize(int size){gridStepSize = size;}
void showGrid(bool bo){isGridEnabled = bo;}
public: public:
GLView(Scene *scene,Camera * camera,Controler *controler ); GLView(Scene *scene,Camera * camera,Controler *controler );
void setHome(QQuaternion *rotation, QVector3D *translation); void setHome(QQuaternion *rotation, QVector3D *translation);
......
...@@ -175,6 +175,42 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -175,6 +175,42 @@ MainWindow::MainWindow(QWidget *parent)
primitivesMenu->addAction(groupAdd); primitivesMenu->addAction(groupAdd);
primitivesMenu->addAction(activeDelete); primitivesMenu->addAction(activeDelete);
showGridButton = new QToolButton(toolBar);
showGridButton->setCheckable(true);
gridSizeInput = new QSpinBox(toolBar);
gridSizeInput->setRange(0,100);
gridSizeInput->setValue(5);
gridSizeInput->setToolTip("Grid Size");
gridStepInput = new QSpinBox(toolBar);
gridStepInput->setRange(1,10);
gridStepInput->setToolTip("Grid Step Size");
connect(gridSizeInput,SIGNAL(valueChanged(int)),perspectiveView,SLOT(setGridSize(int)));
connect(gridStepInput,SIGNAL(valueChanged(int)),perspectiveView,SLOT(setGridStepSize(int)));
connect(showGridButton,SIGNAL(clicked(bool)),perspectiveView,SLOT(showGrid(bool)));
connect(gridSizeInput,SIGNAL(valueChanged(int)),topView,SLOT(setGridSize(int)));
connect(gridStepInput,SIGNAL(valueChanged(int)),topView,SLOT(setGridStepSize(int)));
connect(showGridButton,SIGNAL(clicked(bool)),topView,SLOT(showGrid(bool)));
connect(gridSizeInput,SIGNAL(valueChanged(int)),leftView,SLOT(setGridSize(int)));
connect(gridStepInput,SIGNAL(valueChanged(int)),leftView,SLOT(setGridStepSize(int)));
connect(showGridButton,SIGNAL(clicked(bool)),leftView,SLOT(showGrid(bool)));
connect(gridSizeInput,SIGNAL(valueChanged(int)),frontView,SLOT(setGridSize(int)));
connect(gridStepInput,SIGNAL(valueChanged(int)),frontView,SLOT(setGridStepSize(int)));
connect(showGridButton,SIGNAL(clicked(bool)),frontView,SLOT(showGrid(bool)));
connect(gridSizeInput,SIGNAL(valueChanged(int)),this,SLOT(updateGL()));
connect(gridStepInput,SIGNAL(valueChanged(int)),this,SLOT(updateGL()));
connect(showGridButton,SIGNAL(clicked(bool)),this,SLOT(updateGL()));
// Assemble Menus // Assemble Menus
fileMenu->addAction(exitAction); fileMenu->addAction(exitAction);
...@@ -192,6 +228,12 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -192,6 +228,12 @@ MainWindow::MainWindow(QWidget *parent)
toolBar->addAction(camHome); toolBar->addAction(camHome);
toolBar->addSeparator(); toolBar->addSeparator();
toolBar->addWidget(showGridButton);
toolBar->addWidget(gridSizeInput);
toolBar->addWidget(gridStepInput);
toolBar->addSeparator();
QToolButton* toolButton = new QToolButton(); QToolButton* toolButton = new QToolButton();
toolButton->setIcon(QIcon(":/img/viewports.png")); toolButton->setIcon(QIcon(":/img/viewports.png"));
...@@ -215,6 +257,8 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -215,6 +257,8 @@ MainWindow::MainWindow(QWidget *parent)
addToolBar( toolBar); addToolBar( toolBar);
scene->simpleScene(); scene->simpleScene();
setStatusBar(statusBar); setStatusBar(statusBar);
initDoc(); initDoc();
......
...@@ -71,6 +71,11 @@ private: ...@@ -71,6 +71,11 @@ private:
QTreeView *sceneView; QTreeView *sceneView;
QSpinBox* gridSizeInput;
QSpinBox* gridStepInput;
QToolButton* showGridButton;
void initDoc(); void initDoc();
public: public:
......
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