Skip to content

Commit da6d677

Browse files
committed
add "show time column" to context menu
1 parent 6baf9f6 commit da6d677

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

visualization/motion_planning_tasks/src/task_panel.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,11 @@ TaskViewPrivate::TaskViewPrivate(TaskView* q_ptr) : q_ptr(q_ptr), exec_action_cl
234234
tasks_view->setDropIndicatorShown(true);
235235
tasks_view->setDragEnabled(true);
236236

237+
actionShowTimeColumn->setChecked(true);
238+
237239
// init actions
238240
// TODO(v4hn): add actionAddLocalTask once there is something meaningful to add
239-
tasks_view->addActions({ /*actionAddLocalTask,*/ actionRemoveTaskTreeRows });
241+
tasks_view->addActions({ /*actionAddLocalTask,*/ actionRemoveTaskTreeRows, actionShowTimeColumn });
240242
}
241243

242244
std::pair<TaskListModel*, TaskDisplay*> TaskViewPrivate::getTaskListModel(const QModelIndex& index) const {
@@ -267,6 +269,7 @@ TaskView::TaskView(moveit_rviz_plugin::TaskPanel* parent, rviz::Property* root)
267269
// connect signals
268270
connect(d->actionRemoveTaskTreeRows, SIGNAL(triggered()), this, SLOT(removeSelectedStages()));
269271
connect(d->actionAddLocalTask, SIGNAL(triggered()), this, SLOT(addTask()));
272+
connect(d->actionShowTimeColumn, &QAction::triggered, [this](bool checked) { show_time_column->setValue(checked); });
270273

271274
connect(d->tasks_view->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this,
272275
SLOT(onCurrentStageChanged(QModelIndex, QModelIndex)));
@@ -480,8 +483,10 @@ void TaskView::onExecCurrentSolution() const {
480483

481484
void TaskView::onShowTimeChanged() {
482485
auto* header = d_ptr->tasks_view->header();
486+
bool show = show_time_column->getBool();
483487
if (header->count() > 3)
484-
d_ptr->tasks_view->header()->setSectionHidden(3, !show_time_column->getBool());
488+
d_ptr->tasks_view->header()->setSectionHidden(3, !show);
489+
d_ptr->actionShowTimeColumn->setChecked(show);
485490
}
486491

487492
GlobalSettingsWidgetPrivate::GlobalSettingsWidgetPrivate(GlobalSettingsWidget* q_ptr, rviz::Property* root)

visualization/motion_planning_tasks/src/task_view.ui

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,17 @@
155155
<string>Add task</string>
156156
</property>
157157
</action>
158+
<action name="actionShowTimeColumn">
159+
<property name="checkable">
160+
<bool>true</bool>
161+
</property>
162+
<property name="text">
163+
<string>ShowTimeColumn</string>
164+
</property>
165+
<property name="toolTip">
166+
<string>show time column</string>
167+
</property>
168+
</action>
158169
</widget>
159170
<customwidgets>
160171
<customwidget>

0 commit comments

Comments
 (0)