Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
hpp-gui
Commits
461256d0
Commit
461256d0
authored
Aug 24, 2018
by
Joseph Mirabel
Committed by
Joseph Mirabel
Aug 24, 2018
Browse files
Select corresponding body when a joint is selected.
parent
8de26ab4
Changes
2
Hide whitespace changes
Inline
Side-by-side
plugins/hppwidgetsplugin/jointtreewidget.cc
View file @
461256d0
...
...
@@ -11,6 +11,7 @@
#include
"hppwidgetsplugin/ui_jointtreewidget.h"
#include
<gepetto/gui/mainwindow.hh>
#include
<gepetto/gui/bodytreewidget.hh>
#include
<gepetto/gui/windows-manager.hh>
#include
<gepetto/gui/action-search-bar.hh>
#if GEPETTO_GUI_HAS_PYTHONQT
...
...
@@ -49,6 +50,8 @@ namespace hpp {
SLOT
(
customContextMenu
(
QPoint
)));
connect
(
ui_
->
jointTree
,
SIGNAL
(
expanded
(
QModelIndex
)),
SLOT
(
resize
(
QModelIndex
)));
connect
(
ui_
->
jointTree
->
selectionModel
(),
SIGNAL
(
currentChanged
(
QModelIndex
,
QModelIndex
)),
SLOT
(
currentJointChanged
(
QModelIndex
,
QModelIndex
)));
}
JointTreeWidget
::~
JointTreeWidget
()
...
...
@@ -257,5 +260,26 @@ namespace hpp {
Q_UNUSED
(
index
);
ui_
->
jointTree
->
resizeColumnToContents
(
0
);
}
void
JointTreeWidget
::
currentJointChanged
(
const
QModelIndex
&
current
,
const
QModelIndex
&
previous
)
{
Q_UNUSED
(
previous
);
if
(
current
.
isValid
())
{
JointTreeItem
*
item
=
dynamic_cast
<
JointTreeItem
*>
(
model_
->
itemFromIndex
(
current
));
if
(
item
==
NULL
)
return
;
HppWidgetsPlugin
::
JointMap
::
const_iterator
itj
=
plugin_
->
jointMap
().
find
(
item
->
name
());
if
(
itj
==
plugin_
->
jointMap
().
constEnd
())
return
;
const
HppWidgetsPlugin
::
JointElement
&
je
=
itj
.
value
();
MainWindow
*
main
=
MainWindow
::
instance
();
for
(
std
::
size_t
i
=
0
;
i
<
je
.
bodyNames
.
size
();
++
i
)
{
main
->
bodyTree
()
->
selectBodyByName
(
je
.
bodyNames
[
i
]);
}
}
}
}
// namespace gui
}
// namespace hpp
plugins/hppwidgetsplugin/jointtreewidget.hh
View file @
461256d0
...
...
@@ -65,6 +65,10 @@ signals:
private
slots
:
void
resize
(
const
QModelIndex
index
);
/// Connected to signal "currentChanged" of the selection model of the
/// joint tree view.
void
currentJointChanged
(
const
QModelIndex
&
current
,
const
QModelIndex
&
previous
);
private:
void
initSearchActions
();
...
...
Write
Preview
Supports
Markdown
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