Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
Unterteilungsalgorithmen
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kai Westerkamp
Unterteilungsalgorithmen
Commits
6c991eac
Commit
6c991eac
authored
Sep 01, 2016
by
Kai Westerkamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pfeiltasten wieder eingebaut
parent
5eb26b35
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
3 deletions
+25
-3
mainwidget.cpp
QTProject/mainwidget.cpp
+9
-2
mainwidget.h
QTProject/mainwidget.h
+3
-0
mainwindow.cpp
QTProject/mainwindow.cpp
+12
-1
mainwindow.h
QTProject/mainwindow.h
+1
-0
No files found.
QTProject/mainwidget.cpp
View file @
6c991eac
...
@@ -35,7 +35,14 @@ void MainWidget::keyPressEvent(QKeyEvent *event){
...
@@ -35,7 +35,14 @@ void MainWidget::keyPressEvent(QKeyEvent *event){
}
}
else
if
(
event
->
key
()
==
Qt
::
Key_Plus
){
else
if
(
event
->
key
()
==
Qt
::
Key_Plus
){
cam
->
move
(
QVector3D
(
0.0
,
0.0
,
10
));
cam
->
move
(
QVector3D
(
0.0
,
0.0
,
10
));
}
else
{
}
else
if
(
event
->
key
()
==
Qt
::
Key_Right
||
event
->
key
()
==
Qt
::
Key_D
){
emit
subdifChange
(
1
);
}
else
if
(
event
->
key
()
==
Qt
::
Key_Left
||
event
->
key
()
==
Qt
::
Key_A
){
emit
subdifChange
(
-
1
);
}
else
{
QOpenGLWidget
::
keyPressEvent
(
event
);
QOpenGLWidget
::
keyPressEvent
(
event
);
}
}
}
}
...
@@ -146,7 +153,7 @@ void MainWidget::loadNewMesh(){
...
@@ -146,7 +153,7 @@ void MainWidget::loadNewMesh(){
QString
fn
=
QFileDialog
::
getOpenFileName
(
NULL
,
tr
(
"Open Mesh..."
),
QString
fn
=
QFileDialog
::
getOpenFileName
(
NULL
,
tr
(
"Open Mesh..."
),
QString
(
"..
\\
Models"
),
QString
(
"..
\\
Models"
),
tr
(
"*.md5mesh *.3ds *.md2 *.obj *.dae *.dxf *.mesh.xml *.blend *.b3d"
));
tr
(
"*.md5mesh *.3ds *.md2 *.obj *.dae *.dxf *.mesh.xml *.blend *.b3d"
));
emit
subdifChange
(
0
);
loadNewMesh
(
fn
);
loadNewMesh
(
fn
);
}
}
...
...
QTProject/mainwidget.h
View file @
6c991eac
...
@@ -37,6 +37,9 @@ public slots:
...
@@ -37,6 +37,9 @@ public slots:
void
setWireframe
(
bool
active
);
void
setWireframe
(
bool
active
);
void
subdivide
(
int
level
);
void
subdivide
(
int
level
);
signals
:
void
subdifChange
(
int
value
);
protected
:
protected
:
void
initializeGL
();
void
initializeGL
();
void
paintGL
();
void
paintGL
();
...
...
QTProject/mainwindow.cpp
View file @
6c991eac
...
@@ -48,6 +48,7 @@ MainWindow::MainWindow(QWidget *parent) :
...
@@ -48,6 +48,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect
(
subdivSlider
,
SIGNAL
(
valueChanged
(
int
)),
connect
(
subdivSlider
,
SIGNAL
(
valueChanged
(
int
)),
this
,
SLOT
(
sliderfix
(
int
)));
this
,
SLOT
(
sliderfix
(
int
)));
toolBar
->
addWidget
(
subdivSlider
);
toolBar
->
addWidget
(
subdivSlider
);
...
@@ -55,9 +56,11 @@ MainWindow::MainWindow(QWidget *parent) :
...
@@ -55,9 +56,11 @@ MainWindow::MainWindow(QWidget *parent) :
m_centralWidget
->
setFocusPolicy
(
Qt
::
StrongFocus
);
m_centralWidget
->
setFocusPolicy
(
Qt
::
StrongFocus
);
m_centralWidget
->
setFocus
();
m_centralWidget
->
setFocus
();
// showMaximized();
// showMaximized();
connect
(
m_centralWidget
,
SIGNAL
(
subdifChange
(
int
)),
this
,
SLOT
(
subdifChange
(
int
)));
}
}
void
MainWindow
::
sliderfix
(
int
pos
){
void
MainWindow
::
sliderfix
(
int
pos
){
int
move
=
pos
-
oldSliderpos
;
int
move
=
pos
-
oldSliderpos
;
move
>
0
?
move
=
1
:
move
=
-
1
;
move
>
0
?
move
=
1
:
move
=
-
1
;
int
newPos
=
oldSliderpos
+
move
;
int
newPos
=
oldSliderpos
+
move
;
...
@@ -65,7 +68,15 @@ MainWindow::MainWindow(QWidget *parent) :
...
@@ -65,7 +68,15 @@ MainWindow::MainWindow(QWidget *parent) :
m_centralWidget
->
subdivide
(
newPos
);
m_centralWidget
->
subdivide
(
newPos
);
subdivSlider
->
setSliderPosition
(
newPos
);
subdivSlider
->
setSliderPosition
(
newPos
);
oldSliderpos
=
newPos
;
oldSliderpos
=
newPos
;
}
void
MainWindow
::
subdifChange
(
int
change
){
if
(
change
==
0
){
subdivSlider
->
setSliderPosition
(
0
);
}
}
subdivSlider
->
setSliderPosition
(
subdivSlider
->
sliderPosition
()
+
change
);
m_centralWidget
->
subdivide
(
subdivSlider
->
sliderPosition
());
}
MainWindow
::~
MainWindow
()
MainWindow
::~
MainWindow
()
{
{
...
...
QTProject/mainwindow.h
View file @
6c991eac
...
@@ -21,6 +21,7 @@ public:
...
@@ -21,6 +21,7 @@ public:
public
slots
:
public
slots
:
void
sliderfix
(
int
pos
);
void
sliderfix
(
int
pos
);
void
subdifChange
(
int
change
);
private
:
private
:
int
oldSliderpos
=
0
;
int
oldSliderpos
=
0
;
...
...
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