Commit c19a9d28 by Alisa Jung

zoom in/out with - and + key

parent 14f6e020
......@@ -27,8 +27,17 @@ void MainWidget::wheelEvent(QWheelEvent *event )
cam->move(QVector3D(0.0,0.0,10));
else
cam->move(QVector3D(0.0,0.0,-10));
}
void MainWidget::keyPressEvent(QKeyEvent *event){
if(event->key() == Qt::Key_Minus){
cam->move(QVector3D(0.0,0.0,-10));
}
else if (event->key() == Qt::Key_Plus){
cam->move(QVector3D(0.0,0.0,10));
} else{
QOpenGLWidget::keyPressEvent(event);
}
}
void MainWidget::mousePressEvent(QMouseEvent *event ){
......
......@@ -13,6 +13,7 @@
#include "mesh.h"
#include "camera.h"
#include "subdivision.h"
#include "logcategories.h"
class MainWidget : public QOpenGLWidget, public QOpenGLFunctions_4_3_Core
......@@ -44,6 +45,7 @@ protected:
void mousePressEvent(QMouseEvent *event ) ;
void mouseMoveEvent(QMouseEvent *event ) ;
void wheelEvent(QWheelEvent *event ) ;
void keyPressEvent(QKeyEvent *event ) ;
private:
Camera *cam;
......
......@@ -52,6 +52,7 @@ MainWindow::MainWindow(QWidget *parent) :
this->setCentralWidget(m_centralWidget);
m_centralWidget->setFocusPolicy(Qt::StrongFocus);
// showMaximized();
}
......
......@@ -79,9 +79,6 @@ private:
*/
bool matchAndCompleteTriangleIndices(unsigned int sx, unsigned int sy, unsigned int sz, unsigned int tx, unsigned int ty, unsigned int& tz);
//same as matchandcomplete. doesn't rely on only one index per vertex location
//needs indices to fill tz
/**
* @brief matchAndCompleteTriangle if vertices at indices tx ty matches vertices at indices sxsy, sysz or szsy,
* fill tz with third source vertex index.
......
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