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
10d649c3
Commit
10d649c3
authored
Nov 22, 2015
by
Alisa Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
not sure what is happening. selecting items in tree view works a little.
parent
158eb788
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
23 additions
and
3 deletions
+23
-3
controller.cpp
helloqube/controller.cpp
+8
-0
controller.h
helloqube/controller.h
+3
-0
mainwindow.cpp
helloqube/mainwindow.cpp
+3
-0
myitemmodel.cpp
helloqube/myitemmodel.cpp
+1
-1
myitemmodel.h
helloqube/myitemmodel.h
+1
-1
rigidbodytransformation.cpp
helloqube/rigidbodytransformation.cpp
+1
-1
scenegraph.cpp
helloqube/scenegraph.cpp
+4
-0
scenegraph.h
helloqube/scenegraph.h
+2
-0
No files found.
helloqube/controller.cpp
View file @
10d649c3
...
...
@@ -261,3 +261,11 @@ void Controller::selectTransform(RigidBodyTransformation *rbt){
statusBar
->
showMessage
(
"None selected"
);
}
}
void
Controller
::
itemSelected
(
QModelIndex
q
){
qDebug
()
<<
"item selected. Row: "
<<
q
.
row
()
<<
", column: "
<<
q
.
column
();
qDebug
(
"try to retrieve rbt"
);
TreeItem
*
t
=
scene
->
getItem
(
q
);
if
(
t
->
childNumber
()
==
0
)
t
=
t
->
getParent
();
selectTransform
(
static_cast
<
RigidBodyTransformation
*>
(
t
));
}
helloqube/controller.h
View file @
10d649c3
...
...
@@ -17,6 +17,7 @@
#include <QGridLayout>
#include <rigidbodytransformation.h>
#include <QStatusBar>
#include <QModelIndex>
#include <math.h>
...
...
@@ -95,6 +96,8 @@ public slots:
void
addTorus
();
void
deletePrimitive
();
void
itemSelected
(
QModelIndex
q
);
};
#endif // CONTROLLER_H
helloqube/mainwindow.cpp
View file @
10d649c3
...
...
@@ -254,6 +254,9 @@ MainWindow::MainWindow(QWidget *parent)
dockWidget
->
setWidget
(
treeView
);
addDockWidget
(
Qt
::
RightDockWidgetArea
,
dockWidget
);
connect
(
treeView
,
SIGNAL
(
clicked
(
QModelIndex
)),
controller
,
SLOT
(
itemSelected
(
QModelIndex
)));
}
...
...
helloqube/myitemmodel.cpp
View file @
10d649c3
...
...
@@ -76,7 +76,7 @@ Qt::ItemFlags MyItemModel::flags(const QModelIndex &index) const{
if
(
!
index
.
isValid
()){
return
0
;
}
else
{
return
Qt
::
ItemIsEditable
|
QAbstractItemModel
::
flags
(
index
);
return
Qt
::
ItemIsEditable
|
Q
t
::
ItemIsSelectable
|
Q
AbstractItemModel
::
flags
(
index
);
}
}
...
...
helloqube/myitemmodel.h
View file @
10d649c3
...
...
@@ -24,11 +24,11 @@ public:
void
addNewTransformToRoot
(
TreeItem
*
rbt
,
TreeItem
*
prim
);
void
removeTransformFromRoot
(
TreeItem
*
rbt
);
TreeItem
*
getItem
(
const
QModelIndex
&
index
)
const
;
private
:
TreeItem
*
root
;
TreeItem
*
getItem
(
const
QModelIndex
&
index
)
const
;
};
#endif // MYITEMMODEL_H
helloqube/rigidbodytransformation.cpp
View file @
10d649c3
...
...
@@ -5,7 +5,7 @@ RigidBodyTransformation::RigidBodyTransformation()
{
translation
=
QVector3D
(
0
,
0
,
0
);
rotation
=
QQuaternion
();
name
=
""
;
name
=
"
<rbt>
"
;
// qDebug() << "new rbt " << tx << "," << ty << "," << tz << ", rot " << rotation;
}
...
...
helloqube/scenegraph.cpp
View file @
10d649c3
...
...
@@ -136,3 +136,7 @@ void SceneGraph::notifyViews(){
(
*
i
)
->
modelChanged
();
}
}
TreeItem
*
SceneGraph
::
getItem
(
QModelIndex
q
){
return
model
->
getItem
(
q
);
}
helloqube/scenegraph.h
View file @
10d649c3
...
...
@@ -34,6 +34,8 @@ public:
MyItemModel
*
getModel
();
TreeItem
*
getItem
(
QModelIndex
q
);
//Hallo. Todos:
//Log selected name in status bar
//add remaining primitive types
...
...
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