Commit 5df31a29 by Alisa Jung

zwischenstand

parent 6b35ed3e
...@@ -19,6 +19,8 @@ MyGLWidget::MyGLWidget(int index, Controller* c, bool isPerspective, QQuaternion ...@@ -19,6 +19,8 @@ MyGLWidget::MyGLWidget(int index, Controller* c, bool isPerspective, QQuaternion
rightButtonPressed = false; rightButtonPressed = false;
controller = c; controller = c;
this->isPerspective = isPerspective; this->isPerspective = isPerspective;
setStyleSheet(" border:3px solid rgb(255, 255, 0); ");
} }
MyGLWidget::~MyGLWidget() MyGLWidget::~MyGLWidget()
...@@ -293,7 +295,6 @@ void MyGLWidget::resizeGL(int width, int height){ ...@@ -293,7 +295,6 @@ void MyGLWidget::resizeGL(int width, int height){
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
controller->setScreenScenter(QPoint((double)width/2.0,(double)height/2.0));//lieber zu oft casten bevors nicht tut... controller->setScreenScenter(QPoint((double)width/2.0,(double)height/2.0));//lieber zu oft casten bevors nicht tut...
} }
void MyGLWidget::mousePressEvent(QMouseEvent *event){ void MyGLWidget::mousePressEvent(QMouseEvent *event){
...@@ -317,6 +318,30 @@ void MyGLWidget::keyReleaseEvent(QKeyEvent *event){ ...@@ -317,6 +318,30 @@ void MyGLWidget::keyReleaseEvent(QKeyEvent *event){
} }
} }
void MyGLWidget::paintEvent(QPaintEvent *pe)
{
//reaaaaally weird:
// QStyleOption o;
// o.initFrom(this);
// QPainter p(this);
// style()->drawPrimitive(
// QStyle::PE_Widget, &o, &p, this);
//even weider:
// QStyleOption opt;
// opt.init(this);
// QStylePainter p(this);
// p.drawPrimitive(QStyle::PE_Widget, opt);
//Anyway, the internet tells me I need to do something here in Order to use the style sheet
//and I didn't find any other plausible option to add a border to the selected view.
//A little hint on the assignment would have helped a great deal here...
//need this to actually draw gl stuff
QGLWidget::paintEvent(pe);
};
void MyGLWidget::translateCamera(double xDiff, double yDiff, double zDiff) void MyGLWidget::translateCamera(double xDiff, double yDiff, double zDiff)
{ {
//in order to "move parallel to image plane", we have to rotate the image coordinates xDiff and yDiff by our current camera rotation. //in order to "move parallel to image plane", we have to rotate the image coordinates xDiff and yDiff by our current camera rotation.
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include <QVector3D> #include <QVector3D>
#include <QGLShaderProgram> #include <QGLShaderProgram>
#include <QGLShader> #include <QGLShader>
#include <QStyleOption>
#include <QStylePainter>
class Controller; class Controller;
...@@ -50,6 +52,7 @@ protected: ...@@ -50,6 +52,7 @@ protected:
void wheelEvent(QWheelEvent *event); void wheelEvent(QWheelEvent *event);
void keyPressEvent(QKeyEvent * event); void keyPressEvent(QKeyEvent * event);
void keyReleaseEvent(QKeyEvent *event); void keyReleaseEvent(QKeyEvent *event);
void paintEvent(QPaintEvent *event);
Controller* controller; Controller* controller;
......
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