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
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
13 deletions
+35
-13
mainwidget.cpp
QTProject/mainwidget.cpp
+9
-2
mainwidget.h
QTProject/mainwidget.h
+3
-0
mainwindow.cpp
QTProject/mainwindow.cpp
+22
-11
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
...
@@ -34,11 +34,11 @@ MainWindow::MainWindow(QWidget *parent) :
...
@@ -34,11 +34,11 @@ MainWindow::MainWindow(QWidget *parent) :
connect
(
CamHome
,
SIGNAL
(
triggered
()),
cam
,
SLOT
(
home
()));
connect
(
CamHome
,
SIGNAL
(
triggered
()),
cam
,
SLOT
(
home
()));
toolBar
->
addAction
(
CamHome
);
toolBar
->
addAction
(
CamHome
);
// debugOutput = new QAction("DebugOutput",this);
// debugOutput = new QAction("DebugOutput",this);
// debugOutput->setCheckable(true);
// debugOutput->setCheckable(true);
// debugOutput->setChecked(false);
// debugOutput->setChecked(false);
// connect(debugOutput, SIGNAL(triggered(bool)), m_centralWidget, SLOT(setdebugOutput(bool)));
// connect(debugOutput, SIGNAL(triggered(bool)), m_centralWidget, SLOT(setdebugOutput(bool)));
// toolBar->addAction(debugOutput);
// toolBar->addAction(debugOutput);
subdivSlider
=
new
QSlider
(
Qt
::
Horizontal
);
subdivSlider
=
new
QSlider
(
Qt
::
Horizontal
);
subdivSlider
->
setMinimum
(
0
);
subdivSlider
->
setMinimum
(
0
);
...
@@ -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,17 +56,27 @@ MainWindow::MainWindow(QWidget *parent) :
...
@@ -55,17 +56,27 @@ 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
;
// qDebug()<<"SliderPos"<<oldSliderpos<<move<<newPos;
// qDebug()<<"SliderPos"<<oldSliderpos<<move<<newPos;
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