Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gepetto-viewer-corba
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gepetto
gepetto-viewer-corba
Commits
31c24484
Commit
31c24484
authored
6 years ago
by
Joseph Mirabel
Committed by
Joseph Mirabel
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Clean code in BodyTreeWidget and BodyTreeItem
parent
35c4c642
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/gepetto/gui/bodytreewidget.hh
+0
-41
0 additions, 41 deletions
include/gepetto/gui/bodytreewidget.hh
src/gui/bodytreewidget.cc
+2
-43
2 additions, 43 deletions
src/gui/bodytreewidget.cc
src/gui/tree-item.cc
+0
-3
0 additions, 3 deletions
src/gui/tree-item.cc
with
2 additions
and
87 deletions
include/gepetto/gui/bodytreewidget.hh
+
0
−
41
View file @
31c24484
...
...
@@ -17,23 +17,6 @@
#ifndef GEPETTO_GUI_BODYTREEWIDGET_HH
#define GEPETTO_GUI_BODYTREEWIDGET_HH
// This does not work because of qt meta-object compiler
#define GEPETTO_GUI_BODYTREE_DECL_FEATURE(func, ArgType) \
public slots: \
void func (ArgType arg)
#define GEPETTO_GUI_BODYTREE_IMPL_FEATURE(func, ArgType, OutType, WindowsManagerFunc) \
void BodyTreeWidget::func (ArgType arg) { \
WindowsManagerPtr_t wsm = MainWindow::instance()->osg(); \
foreach (const QModelIndex& index, view_->selectionModel ()->selectedIndexes ()) { \
const BodyTreeItem *item = dynamic_cast <const BodyTreeItem*> \
(model_->itemFromIndex (index)); \
if (item) wsm->WindowsManagerFunc (item->node()->getID(), \
convertTo<OutType>::from(arg)); \
else \
qDebug() << model_->itemFromIndex(index)->text() << "is not a BodyTreeItem"; \
} \
}
#include
<QWidget>
#include
<QTreeView>
#include
<QToolBox>
...
...
@@ -63,10 +46,6 @@ namespace gepetto {
virtual
~
BodyTreeWidget
()
{}
/// Display the value in the slider.
/// \param alpha alpha value to convert
void
changeAlphaValue
(
const
float
&
alpha
);
/// Get the body tree view.
QTreeView
*
view
();
...
...
@@ -95,26 +74,6 @@ namespace gepetto {
/// Get selected bodies
QList
<
BodyTreeItem
*>
selectedBodies
()
const
;
/// Set the transparency of currently selected body.
/// \param value value of the slider to convert
void
setTransparency
(
int
value
);
/// Set the visibility mode of currently selected body.
/// \param arg visibility mode
void
setVisibilityMode
(
QString
arg
);
/// Set the wireframe mode of currently selected body.
/// \param arg wireframe mode
void
setWireFrameMode
(
QString
arg
);
/// Set the color of currently selected body.
/// \param color new color of the body
void
setColor
(
QColor
color
);
/// Set the scale of currently selected body.
/// \param scale new scale of the body
void
setScale
(
int
scale
);
/// \}
protected
slots
:
...
...
This diff is collapsed.
Click to expand it.
src/gui/bodytreewidget.cc
+
2
−
43
View file @
31c24484
...
...
@@ -29,26 +29,7 @@
#include
<QHBoxLayout>
#include
<QApplication>
static
void
addSelector
(
QToolBox
*
tb
,
QString
title
,
QStringList
display
,
QStringList
command
,
QObject
*
receiver
,
const
char
*
slot
)
{
QWidget
*
newW
=
new
QWidget
();
newW
->
setObjectName
(
title
);
QSignalMapper
*
mapper
=
new
QSignalMapper
(
tb
);
QHBoxLayout
*
layout
=
new
QHBoxLayout
(
newW
);
layout
->
setSpacing
(
6
);
layout
->
setContentsMargins
(
11
,
11
,
11
,
11
);
layout
->
setObjectName
(
title
+
"_layout"
);
for
(
int
i
=
0
;
i
<
display
.
size
();
++
i
)
{
QPushButton
*
button
=
new
QPushButton
(
display
[
i
],
newW
);
button
->
setObjectName
(
title
+
"_button_"
+
display
[
i
]);
layout
->
addWidget
(
button
);
mapper
->
setMapping
(
button
,
command
[
i
]);
QObject
::
connect
(
button
,
SIGNAL
(
clicked
(
bool
)),
mapper
,
SLOT
(
map
()));
}
receiver
->
connect
(
mapper
,
SIGNAL
(
mapped
(
QString
)),
slot
);
tb
->
addItem
(
newW
,
title
);
}
/*
static void addColorSelector (QToolBox* tb, QString title, QObject* receiver, const char* slot) {
QWidget* newW = new QWidget();
newW->setObjectName(title);
...
...
@@ -69,16 +50,7 @@ static void addColorSelector (QToolBox* tb, QString title, QObject* receiver, co
receiver->connect (colorDialog, SIGNAL(colorSelected(QColor)), slot);
tb->addItem(newW, title);
}
static
void
addSlider
(
QToolBox
*
tb
,
QString
title
,
QObject
*
receiver
,
const
char
*
slot
)
{
QSlider
*
slider
=
new
QSlider
(
Qt
::
Horizontal
);
slider
->
setMinimum
(
0
);
slider
->
setMaximum
(
100
);
slider
->
setObjectName
(
title
);
receiver
->
connect
(
slider
,
SIGNAL
(
valueChanged
(
int
)),
slot
);
tb
->
addItem
(
slider
,
title
);
}
*/
namespace
gepetto
{
namespace
gui
{
...
...
@@ -234,18 +206,5 @@ namespace gepetto {
contextMenu
.
exec
(
view_
->
mapToGlobal
(
pos
));
}
}
void
BodyTreeWidget
::
changeAlphaValue
(
const
float
&
alpha
)
{
QSlider
*
tr
=
qobject_cast
<
QSlider
*>
(
toolBox_
->
widget
(
0
));
tr
->
setValue
((
int
)
alpha
*
100
);
}
GEPETTO_GUI_BODYTREE_IMPL_FEATURE
(
setTransparency
,
int
,
int
,
setAlpha
)
GEPETTO_GUI_BODYTREE_IMPL_FEATURE
(
setVisibilityMode
,
QString
,
std
::
string
,
setVisibility
)
GEPETTO_GUI_BODYTREE_IMPL_FEATURE
(
setWireFrameMode
,
QString
,
std
::
string
,
setWireFrameMode
)
GEPETTO_GUI_BODYTREE_IMPL_FEATURE
(
setColor
,
QColor
,
WindowsManager
::
Color_t
,
setColor
)
GEPETTO_GUI_BODYTREE_IMPL_FEATURE
(
setScale
,
int
,
int
,
setScale
)
}
}
This diff is collapsed.
Click to expand it.
src/gui/tree-item.cc
+
0
−
3
View file @
31c24484
...
...
@@ -50,7 +50,6 @@ namespace gepetto {
int
indexSelected
=
0
;
for
(
std
::
size_t
i
=
0
;
i
<
enumMeta
->
values
.
size
();
++
i
)
{
qDebug
()
<<
enumMeta
->
names
[
i
].
c_str
()
<<
":"
<<
enumMeta
->
values
[
i
];
cb
->
addItem
(
enumMeta
->
names
[
i
].
c_str
(),
enumMeta
->
values
[
i
]);
if
(
value
==
enumMeta
->
values
[
i
])
indexSelected
=
i
;
}
...
...
@@ -149,7 +148,6 @@ namespace gepetto {
if
(
sender
!=
NULL
)
{
QVariant
nameVariant
=
sender
->
property
(
"propertyName"
);
if
(
nameVariant
.
isValid
())
{
qDebug
()
<<
"Set property"
<<
nameVariant
;
std
::
string
name
=
nameVariant
.
toString
().
toStdString
();
boost
::
mutex
::
scoped_lock
lock
(
MainWindow
::
instance
()
->
osg
()
->
osgFrameMutex
());
node_
->
setProperty
<
T
>
(
name
,
value
);
...
...
@@ -174,7 +172,6 @@ namespace gepetto {
void
BodyTreeItem
::
setFloatProperty
(
const
double
&
value
)
const
{
qDebug
()
<<
"Set property"
<<
float
(
value
);
setProperty
(
QObject
::
sender
(),
float
(
value
));
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment