Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
grapa_alisa
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Alisa Jung
grapa_alisa
Commits
5df31a29
Commit
5df31a29
authored
Nov 15, 2015
by
Alisa Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zwischenstand
parent
6b35ed3e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
myglwidget.cpp
helloqube/myglwidget.cpp
+26
-1
myglwidget.h
helloqube/myglwidget.h
+3
-0
No files found.
helloqube/myglwidget.cpp
View file @
5df31a29
...
@@ -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.
...
...
helloqube/myglwidget.h
View file @
5df31a29
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment