mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
TaskPanel: separate widget classes
TaskPanel, TaskView, TaskSettings, ...
This commit is contained in:
parent
3a4dc6755b
commit
193d3fef67
@ -1,6 +1,10 @@
|
|||||||
set(MOVEIT_LIB_NAME motion_planning_tasks_rviz_plugin)
|
set(MOVEIT_LIB_NAME motion_planning_tasks_rviz_plugin)
|
||||||
|
|
||||||
qt_wrap_ui(UIC_FILES task_panel.ui)
|
qt_wrap_ui(UIC_FILES
|
||||||
|
task_panel.ui
|
||||||
|
task_view.ui
|
||||||
|
task_settings.ui
|
||||||
|
)
|
||||||
|
|
||||||
add_library(${MOVEIT_LIB_NAME}
|
add_library(${MOVEIT_LIB_NAME}
|
||||||
factory_model.cpp
|
factory_model.cpp
|
||||||
|
|||||||
@ -79,13 +79,15 @@ TaskPanel::TaskPanel(QWidget* parent)
|
|||||||
: rviz::Panel(parent), d_ptr(new TaskPanelPrivate(this))
|
: rviz::Panel(parent), d_ptr(new TaskPanelPrivate(this))
|
||||||
{
|
{
|
||||||
Q_D(TaskPanel);
|
Q_D(TaskPanel);
|
||||||
// connect signals
|
|
||||||
connect(d->actionRemoveTaskTreeRows, SIGNAL(triggered()), this, SLOT(removeSelectedStages()));
|
|
||||||
connect(d->actionAddLocalTask, SIGNAL(triggered()), this, SLOT(addTask()));
|
|
||||||
connect(d->button_show_stage_dock_widget, SIGNAL(clicked()), this, SLOT(showStageDockWidget()));
|
|
||||||
|
|
||||||
connect(d->tasks_view->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)),
|
d->tasks_widget = new TaskView(this);
|
||||||
this, SLOT(onCurrentStageChanged(QModelIndex,QModelIndex)));
|
d->settings_widget = new TaskSettings(this);
|
||||||
|
layout()->addWidget(d->tasks_widget);
|
||||||
|
layout()->addWidget(d->settings_widget);
|
||||||
|
|
||||||
|
connect(d->button_show_stage_dock_widget, SIGNAL(clicked()), this, SLOT(showStageDockWidget()));
|
||||||
|
connect(d->button_show_settings, SIGNAL(toggled(bool)), d->settings_widget, SLOT(setVisible(bool)));
|
||||||
|
d->settings_widget->setVisible(d->button_show_settings->isChecked());
|
||||||
|
|
||||||
// if still undefined, this becomes the global instance
|
// if still undefined, this becomes the global instance
|
||||||
if (TaskPanelPrivate::global_instance_.isNull()) {
|
if (TaskPanelPrivate::global_instance_.isNull()) {
|
||||||
@ -127,14 +129,41 @@ void TaskPanel::decUseCount()
|
|||||||
|
|
||||||
TaskPanelPrivate::TaskPanelPrivate(TaskPanel *q_ptr)
|
TaskPanelPrivate::TaskPanelPrivate(TaskPanel *q_ptr)
|
||||||
: q_ptr(q_ptr)
|
: q_ptr(q_ptr)
|
||||||
, settings(new rviz::PropertyTreeModel(new rviz::Property, q_ptr))
|
|
||||||
{
|
{
|
||||||
setupUi(q_ptr);
|
setupUi(q_ptr);
|
||||||
// init tasks view
|
button_show_stage_dock_widget->setEnabled(bool(getStageFactory()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskPanel::onInitialize()
|
||||||
|
{
|
||||||
|
d_ptr->window_manager_ = vis_manager_->getWindowManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskPanel::save(rviz::Config config) const
|
||||||
|
{
|
||||||
|
rviz::Panel::save(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskPanel::load(const rviz::Config& config)
|
||||||
|
{
|
||||||
|
rviz::Panel::load(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TaskPanel::showStageDockWidget()
|
||||||
|
{
|
||||||
|
rviz::PanelDockWidget *dock = getStageDockWidget(d_ptr->window_manager_);
|
||||||
|
if (dock) dock->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TaskViewPrivate::TaskViewPrivate(TaskView *q_ptr)
|
||||||
|
: q_ptr(q_ptr)
|
||||||
|
{
|
||||||
|
setupUi(q_ptr);
|
||||||
|
|
||||||
MetaTaskListModel *meta_model = &MetaTaskListModel::instance();
|
MetaTaskListModel *meta_model = &MetaTaskListModel::instance();
|
||||||
StageFactoryPtr factory = getStageFactory();
|
StageFactoryPtr factory = getStageFactory();
|
||||||
if (factory) meta_model->setMimeTypes( { factory->mimeType() } );
|
if (factory) meta_model->setMimeTypes( { factory->mimeType() } );
|
||||||
else button_show_stage_dock_widget->setEnabled(false);
|
|
||||||
tasks_view->setModel(meta_model);
|
tasks_view->setModel(meta_model);
|
||||||
|
|
||||||
tasks_view->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
tasks_view->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
@ -148,30 +177,23 @@ TaskPanelPrivate::TaskPanelPrivate(TaskPanel *q_ptr)
|
|||||||
|
|
||||||
// init actions
|
// init actions
|
||||||
tasks_view->addActions({actionRemoveTaskTreeRows, actionAddLocalTask});
|
tasks_view->addActions({actionRemoveTaskTreeRows, actionAddLocalTask});
|
||||||
|
|
||||||
initSettings(settings->getRoot());
|
|
||||||
settings_view->setModel(settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TaskPanelPrivate::initSettings(rviz::Property* root)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<TaskListModel*, TaskDisplay*>
|
std::pair<TaskListModel*, TaskDisplay*>
|
||||||
TaskPanelPrivate::getTaskListModel(const QModelIndex &index) const
|
TaskViewPrivate::getTaskListModel(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
auto *meta_model = static_cast<MetaTaskListModel*>(tasks_view->model());
|
auto *meta_model = static_cast<MetaTaskListModel*>(tasks_view->model());
|
||||||
return meta_model->getTaskListModel(index);
|
return meta_model->getTaskListModel(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<BaseTaskModel*, QModelIndex>
|
std::pair<BaseTaskModel*, QModelIndex>
|
||||||
TaskPanelPrivate::getTaskModel(const QModelIndex &index) const
|
TaskViewPrivate::getTaskModel(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
auto *meta_model = static_cast<MetaTaskListModel*>(tasks_view->model());
|
auto *meta_model = static_cast<MetaTaskListModel*>(tasks_view->model());
|
||||||
return meta_model->getTaskModel(index);
|
return meta_model->getTaskModel(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskPanelPrivate::unlock(TaskDisplay* display)
|
void TaskViewPrivate::unlock(TaskDisplay* display)
|
||||||
{
|
{
|
||||||
if (locked_display_ && locked_display_ != display) {
|
if (locked_display_ && locked_display_ != display) {
|
||||||
locked_display_->clearMarkers();
|
locked_display_->clearMarkers();
|
||||||
@ -180,56 +202,38 @@ void TaskPanelPrivate::unlock(TaskDisplay* display)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskPanel::onInitialize()
|
TaskView::TaskView(QWidget *parent)
|
||||||
|
: QWidget(parent), d_ptr(new TaskViewPrivate(this))
|
||||||
{
|
{
|
||||||
d_ptr->window_manager_ = vis_manager_->getWindowManager();
|
Q_D(TaskView);
|
||||||
|
|
||||||
|
// connect signals
|
||||||
|
connect(d->actionRemoveTaskTreeRows, SIGNAL(triggered()), this, SLOT(removeSelectedStages()));
|
||||||
|
connect(d->actionAddLocalTask, SIGNAL(triggered()), this, SLOT(addTask()));
|
||||||
|
|
||||||
|
connect(d->tasks_view->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)),
|
||||||
|
this, SLOT(onCurrentStageChanged(QModelIndex,QModelIndex)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskPanel::save(rviz::Config config) const
|
void TaskView::addTask()
|
||||||
{
|
|
||||||
rviz::Panel::save(config);
|
|
||||||
d_ptr->settings->getRoot()->save(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TaskPanel::load(const rviz::Config& config)
|
|
||||||
{
|
|
||||||
rviz::Panel::load(config);
|
|
||||||
d_ptr->settings->getRoot()->load(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TaskPanel::addTask()
|
|
||||||
{
|
{
|
||||||
TaskListModel* task_list_model = nullptr;
|
TaskListModel* task_list_model = nullptr;
|
||||||
QModelIndex current = d_ptr->tasks_view->currentIndex();
|
QModelIndex current = d_ptr->tasks_view->currentIndex();
|
||||||
if (!current.isValid()) {
|
if (current.isValid()) {
|
||||||
// create new TaskDisplay
|
|
||||||
TaskDisplay *display = new TaskDisplay();
|
|
||||||
display->setName("Motion Planning Task");
|
|
||||||
vis_manager_->getRootDisplayGroup()->addDisplay(display);
|
|
||||||
display->initialize(vis_manager_);
|
|
||||||
display->setEnabled(true);
|
|
||||||
|
|
||||||
task_list_model = &display->getTaskListModel();
|
|
||||||
} else
|
|
||||||
task_list_model = d_ptr->getTaskListModel(current).first;
|
task_list_model = d_ptr->getTaskListModel(current).first;
|
||||||
|
task_list_model->insertModel(new LocalTaskModel(task_list_model), current.row());
|
||||||
task_list_model->insertModel(new LocalTaskModel(task_list_model), current.row());
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskPanel::showStageDockWidget()
|
void TaskView::removeSelectedStages()
|
||||||
{
|
|
||||||
rviz::PanelDockWidget *dock = getStageDockWidget(d_ptr->window_manager_);
|
|
||||||
if (dock) dock->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TaskPanel::removeSelectedStages()
|
|
||||||
{
|
{
|
||||||
auto *m = d_ptr->tasks_view->model();
|
auto *m = d_ptr->tasks_view->model();
|
||||||
for (const auto &range : d_ptr->tasks_view->selectionModel()->selection())
|
for (const auto &range : d_ptr->tasks_view->selectionModel()->selection())
|
||||||
m->removeRows(range.top(), range.bottom()-range.top()+1, range.parent());
|
m->removeRows(range.top(), range.bottom()-range.top()+1, range.parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskPanel::onCurrentStageChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
void TaskView::onCurrentStageChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
||||||
{
|
{
|
||||||
BaseTaskModel *task;
|
BaseTaskModel *task;
|
||||||
QModelIndex task_index;
|
QModelIndex task_index;
|
||||||
@ -255,7 +259,7 @@ void TaskPanel::onCurrentStageChanged(const QModelIndex ¤t, const QModelIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskPanel::onCurrentSolutionChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
void TaskView::onCurrentSolutionChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
||||||
{
|
{
|
||||||
TaskDisplay *display = d_ptr->getTaskListModel(d_ptr->tasks_view->currentIndex()).second;
|
TaskDisplay *display = d_ptr->getTaskListModel(d_ptr->tasks_view->currentIndex()).second;
|
||||||
d_ptr->unlock(display);
|
d_ptr->unlock(display);
|
||||||
@ -274,7 +278,7 @@ void TaskPanel::onCurrentSolutionChanged(const QModelIndex ¤t, const QMode
|
|||||||
vis->showTrajectory(solution, true);
|
vis->showTrajectory(solution, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskPanel::onSolutionSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
|
void TaskView::onSolutionSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
|
||||||
{
|
{
|
||||||
QItemSelectionModel *sm = d_ptr->solutions_view->selectionModel();
|
QItemSelectionModel *sm = d_ptr->solutions_view->selectionModel();
|
||||||
const QModelIndexList& selected_rows = sm->selectedRows();
|
const QModelIndexList& selected_rows = sm->selectedRows();
|
||||||
@ -292,6 +296,19 @@ void TaskPanel::onSolutionSelectionChanged(const QItemSelection &selected, const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TaskSettingsPrivate::TaskSettingsPrivate(TaskSettings *q_ptr)
|
||||||
|
: q_ptr(q_ptr)
|
||||||
|
{
|
||||||
|
setupUi(q_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskSettings::TaskSettings(QWidget *parent)
|
||||||
|
: QWidget(parent), d_ptr(new TaskSettingsPrivate(this))
|
||||||
|
{
|
||||||
|
Q_D(TaskSettings);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_task_panel.cpp"
|
#include "moc_task_panel.cpp"
|
||||||
|
|||||||
@ -82,9 +82,23 @@ public:
|
|||||||
void load(const rviz::Config& config) override;
|
void load(const rviz::Config& config) override;
|
||||||
void save(rviz::Config config) const override;
|
void save(rviz::Config config) const override;
|
||||||
|
|
||||||
|
protected Q_SLOTS:
|
||||||
|
void showStageDockWidget();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class MetaTaskListModel;
|
||||||
|
class TaskViewPrivate;
|
||||||
|
class TaskView : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_DECLARE_PRIVATE(TaskView)
|
||||||
|
TaskViewPrivate *d_ptr;
|
||||||
|
|
||||||
|
public:
|
||||||
|
TaskView(QWidget* parent = 0);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void addTask();
|
void addTask();
|
||||||
void showStageDockWidget();
|
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void removeSelectedStages();
|
void removeSelectedStages();
|
||||||
@ -93,4 +107,15 @@ protected Q_SLOTS:
|
|||||||
void onSolutionSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
void onSolutionSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class TaskSettingsPrivate;
|
||||||
|
class TaskSettings : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_DECLARE_PRIVATE(TaskSettings)
|
||||||
|
TaskSettingsPrivate *d_ptr;
|
||||||
|
|
||||||
|
public:
|
||||||
|
TaskSettings(QWidget* parent = 0);
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,9 +14,6 @@
|
|||||||
<string>Tasks Panel</string>
|
<string>Tasks Panel</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@ -30,193 +27,49 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="currentIndex">
|
<item>
|
||||||
<number>0</number>
|
<widget class="QToolButton" name="button_show_settings">
|
||||||
</property>
|
<property name="text">
|
||||||
<widget class="QWidget" name="tab_tasks">
|
<string>...</string>
|
||||||
<attribute name="icon">
|
|
||||||
<iconset resource="resources.qrc">
|
|
||||||
<normaloff>:/icons/tasks.png</normaloff>:/icons/tasks.png</iconset>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="title">
|
|
||||||
<string/>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="tab_tasks_layout">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="icon">
|
||||||
<number>0</number>
|
<iconset resource="resources.qrc">
|
||||||
|
<normaloff>:/icons/settings.png</normaloff>:/icons/settings.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="checkable">
|
||||||
<number>0</number>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
</widget>
|
||||||
<number>0</number>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="sizeHint" stdset="0">
|
||||||
<number>0</number>
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
</spacer>
|
||||||
<layout class="QHBoxLayout" name="tasks_view_label_layout">
|
</item>
|
||||||
<property name="spacing">
|
<item>
|
||||||
<number>6</number>
|
<widget class="QToolButton" name="button_show_stage_dock_widget">
|
||||||
</property>
|
<property name="text">
|
||||||
<item>
|
<string>...</string>
|
||||||
<widget class="QLabel" name="tasks_view_label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Task Tree</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="button_show_stage_dock_widget">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>18</width>
|
|
||||||
<height>18</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="resources.qrc">
|
|
||||||
<normaloff>:/icons/new-stage.png</normaloff>:/icons/new-stage.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSplitter" name="splitter">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<widget class="moveit_rviz_plugin::TaskListView" name="tasks_view">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="contextMenuPolicy">
|
|
||||||
<enum>Qt::ActionsContextMenu</enum>
|
|
||||||
</property>
|
|
||||||
<attribute name="headerStretchLastSection">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
<widget class="moveit_rviz_plugin::AutoAdjustingTreeView" name="solutions_view">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
|
||||||
<horstretch>1</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="selectionMode">
|
|
||||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
|
||||||
</property>
|
|
||||||
<property name="rootIsDecorated">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="uniformRowHeights">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="sortingEnabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<attribute name="headerStretchLastSection">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_settings">
|
|
||||||
<attribute name="icon">
|
|
||||||
<iconset resource="resources.qrc">
|
|
||||||
<normaloff>:/icons/settings.png</normaloff>:/icons/settings.png</iconset>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="title">
|
|
||||||
<string/>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="tab_settings_layout">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="icon">
|
||||||
<number>0</number>
|
<iconset resource="resources.qrc">
|
||||||
|
<normaloff>:/icons/new-stage.png</normaloff>:/icons/new-stage.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
</widget>
|
||||||
<number>0</number>
|
</item>
|
||||||
</property>
|
</layout>
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="settings_view_label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Settings</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="rviz::PropertyTreeWidget" name="settings_view"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
<action name="actionRemoveTaskTreeRows">
|
|
||||||
<property name="text">
|
|
||||||
<string>Remove</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Remove selected rows</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Del</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcutContext">
|
|
||||||
<enum>Qt::WidgetShortcut</enum>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionAddLocalTask">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add task</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>rviz::PropertyTreeWidget</class>
|
|
||||||
<extends>QTreeView</extends>
|
|
||||||
<header location="global">rviz/properties/property_tree_widget.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>moveit_rviz_plugin::TaskListView</class>
|
|
||||||
<extends>QTreeView</extends>
|
|
||||||
<header>task_list_model.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>moveit_rviz_plugin::AutoAdjustingTreeView</class>
|
|
||||||
<extends>QTreeView</extends>
|
|
||||||
<header>task_list_model.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources>
|
<resources>
|
||||||
<include location="resources.qrc"/>
|
<include location="resources.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@ -40,6 +40,8 @@
|
|||||||
|
|
||||||
#include "task_panel.h"
|
#include "task_panel.h"
|
||||||
#include "ui_task_panel.h"
|
#include "ui_task_panel.h"
|
||||||
|
#include "ui_task_view.h"
|
||||||
|
#include "ui_task_settings.h"
|
||||||
|
|
||||||
#include <rviz/panel.h>
|
#include <rviz/panel.h>
|
||||||
#include <rviz/properties/property_tree_model.h>
|
#include <rviz/properties/property_tree_model.h>
|
||||||
@ -55,7 +57,19 @@ class TaskPanelPrivate : public Ui_TaskPanel {
|
|||||||
public:
|
public:
|
||||||
TaskPanelPrivate(TaskPanel *q_ptr);
|
TaskPanelPrivate(TaskPanel *q_ptr);
|
||||||
|
|
||||||
void initSettings(rviz::Property *root);
|
TaskPanel* q_ptr;
|
||||||
|
TaskView* tasks_widget;
|
||||||
|
TaskSettings* settings_widget;
|
||||||
|
|
||||||
|
rviz::WindowManagerInterface* window_manager_;
|
||||||
|
static QPointer<TaskPanel> global_instance_;
|
||||||
|
static uint global_use_count_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class TaskViewPrivate : public Ui_TaskView {
|
||||||
|
public:
|
||||||
|
TaskViewPrivate(TaskView *q_ptr);
|
||||||
|
|
||||||
/// retrieve TaskListModel corresponding to given index
|
/// retrieve TaskListModel corresponding to given index
|
||||||
inline std::pair<TaskListModel*, TaskDisplay*>
|
inline std::pair<TaskListModel*, TaskDisplay*>
|
||||||
@ -68,13 +82,16 @@ public:
|
|||||||
/// unlock locked_display_ if given display is different
|
/// unlock locked_display_ if given display is different
|
||||||
void unlock(TaskDisplay *display);
|
void unlock(TaskDisplay *display);
|
||||||
|
|
||||||
TaskPanel* q_ptr;
|
TaskView *q_ptr;
|
||||||
rviz::PropertyTreeModel* settings;
|
|
||||||
QPointer<TaskDisplay> locked_display_;
|
QPointer<TaskDisplay> locked_display_;
|
||||||
rviz::WindowManagerInterface* window_manager_;
|
};
|
||||||
|
|
||||||
static QPointer<TaskPanel> global_instance_;
|
|
||||||
static uint global_use_count_;
|
class TaskSettingsPrivate : public Ui_TaskSettings {
|
||||||
|
public:
|
||||||
|
TaskSettingsPrivate(TaskSettings *q_ptr);
|
||||||
|
|
||||||
|
TaskSettings *q_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
69
visualization/motion_planning_tasks/src/task_settings.ui
Normal file
69
visualization/motion_planning_tasks/src/task_settings.ui
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>moveit_rviz_plugin::TaskSettings</class>
|
||||||
|
<widget class="QWidget" name="moveit_rviz_plugin::TaskSettings">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="tab_settings_layout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="settings_view_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="rviz::PropertyTreeWidget" name="settings_view"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>rviz::PropertyTreeWidget</class>
|
||||||
|
<extends>QTreeView</extends>
|
||||||
|
<header location="global">rviz/properties/property_tree_widget.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
150
visualization/motion_planning_tasks/src/task_view.ui
Normal file
150
visualization/motion_planning_tasks/src/task_view.ui
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>moveit_rviz_plugin::TaskView</class>
|
||||||
|
<widget class="QWidget" name="moveit_rviz_plugin::TaskView">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Tasks Panel</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="tasks_overview">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="tasks_view_label_layout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="tasks_view_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Task Tree</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSplitter" name="splitter">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="moveit_rviz_plugin::TaskListView" name="tasks_view">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>2</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::ActionsContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<attribute name="headerStretchLastSection">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="moveit_rviz_plugin::AutoAdjustingTreeView" name="solutions_view">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="rootIsDecorated">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="uniformRowHeights">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sortingEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="headerStretchLastSection">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
<action name="actionRemoveTaskTreeRows">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Remove selected rows</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Del</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcutContext">
|
||||||
|
<enum>Qt::WidgetShortcut</enum>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionAddLocalTask">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add task</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>moveit_rviz_plugin::TaskListView</class>
|
||||||
|
<extends>QTreeView</extends>
|
||||||
|
<header>task_list_model.h</header>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>moveit_rviz_plugin::AutoAdjustingTreeView</class>
|
||||||
|
<extends>QTreeView</extends>
|
||||||
|
<header>task_list_model.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
Loading…
Reference in New Issue
Block a user