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
343154d7
Commit
343154d7
authored
Nov 23, 2015
by
Alisa Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
button to show/hide grid
parent
46873760
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
0 deletions
+21
-0
gridIcon.png
helloqube/grapa-a2-iconset/gridIcon.png
+0
-0
helloqube.qrc
helloqube/helloqube.qrc
+1
-0
mainwindow.cpp
helloqube/mainwindow.cpp
+10
-0
mainwindow.h
helloqube/mainwindow.h
+1
-0
myglwidget.cpp
helloqube/myglwidget.cpp
+7
-0
myglwidget.h
helloqube/myglwidget.h
+2
-0
No files found.
helloqube/grapa-a2-iconset/gridIcon.png
0 → 100644
View file @
343154d7
1.76 KB
helloqube/helloqube.qrc
View file @
343154d7
...
...
@@ -18,5 +18,6 @@
<file>grapa-a2-iconset/view-dual.png</file>
<file>grapa-a2-iconset/viewports.png</file>
<file>grapa-a2-iconset/view-single.png</file>
<file>grapa-a2-iconset/gridIcon.png</file>
</qresource>
</RCC>
helloqube/mainwindow.cpp
View file @
343154d7
...
...
@@ -220,6 +220,12 @@ MainWindow::MainWindow(QWidget *parent)
}
showGridButton
=
new
QToolButton
(
toolBar
);
showGridButton
->
setIcon
(
QIcon
(
":/grapa-a2-iconset/gridIcon.png"
));
toolBar
->
addWidget
(
showGridButton
);
showGridButton
->
setCheckable
(
true
);
gridSizeInput
=
new
QSpinBox
(
toolBar
);
gridSizeInput
->
setRange
(
0
,
100
);
gridSizeInput
->
setValue
(
5
);
...
...
@@ -231,9 +237,13 @@ MainWindow::MainWindow(QWidget *parent)
toolBar
->
addWidget
(
gridStepInput
);
gridStepInput
->
setToolTip
(
"Grid Step Size"
);
for
(
int
i
=
0
;
i
<
4
;
i
++
){
connect
(
gridSizeInput
,
SIGNAL
(
valueChanged
(
int
)),
allWidgets
[
i
],
SLOT
(
setGridSize
(
int
)));
connect
(
gridStepInput
,
SIGNAL
(
valueChanged
(
int
)),
allWidgets
[
i
],
SLOT
(
setGridStepSize
(
int
)));
connect
(
showGridButton
,
SIGNAL
(
clicked
(
bool
)),
allWidgets
[
i
],
SLOT
(
showGrid
(
bool
)));
}
qDebug
(
"Done initializing"
);
...
...
helloqube/mainwindow.h
View file @
343154d7
...
...
@@ -95,6 +95,7 @@ private:
QSpinBox
*
gridSizeInput
;
QSpinBox
*
gridStepInput
;
QToolButton
*
showGridButton
;
public
slots
:
void
showAboutBox
(
)
;
...
...
helloqube/myglwidget.cpp
View file @
343154d7
...
...
@@ -24,6 +24,7 @@ MyGLWidget::MyGLWidget(int index, Controller* c, bool isPerspective, QQuaternion
gridSize
=
5
;
gridStepSize
=
1
;
doShowGrid
=
false
;
}
MyGLWidget
::~
MyGLWidget
()
...
...
@@ -593,6 +594,7 @@ void MyGLWidget::drawTorus(int tesselation){
}
void
MyGLWidget
::
drawGrid
(){
if
(
!
doShowGrid
)
return
;
GLfloat
specularColor
[]
=
{
0
,
0
,
0
};
GLfloat
shininess
[]
=
{
128
};
glMaterialfv
(
GL_FRONT
,
GL_SPECULAR
,
specularColor
);
...
...
@@ -656,3 +658,8 @@ void MyGLWidget::setGridStepSize(int stepSize){
gridStepSize
=
stepSize
;
updateGL
();
}
void
MyGLWidget
::
showGrid
(
bool
doShowGrid
){
this
->
doShowGrid
=
doShowGrid
;
updateGL
();
}
helloqube/myglwidget.h
View file @
343154d7
...
...
@@ -106,11 +106,13 @@ private:
int
gridSize
;
int
gridStepSize
;
bool
doShowGrid
;
public
slots
:
//4.1.1 slots for shading modes
void
resetCamera
();
void
setGridSize
(
int
size
);
void
setGridStepSize
(
int
stepSize
);
void
showGrid
(
bool
doShowGrid
);
};
#endif // GLWIDGET_H
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