mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-08 20:40:21 +08:00
DBViewer: support doubleclick on node or link in graphview to update correpsonding image view and constraints view, also added "Show pixel depth" menu option in ImageView to show pixel depth and pixel coordinate in map frame.
This commit is contained in:
@@ -1797,7 +1797,7 @@ void GraphViewer::mouseMoveEvent(QMouseEvent * event)
|
||||
if(_mouseTracking && _viewPlane==XY && this->sceneRect().contains(scenePoint))
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QToolTip::showText(event->globalPosition().toPoint(), QString("%1,%2").arg(scenePoint.x()/100.0).arg(scenePoint.y()/100.0));
|
||||
QToolTip::showText(event->globalPosition().toPoint(), QString("%1m %2m").arg(-scenePoint.y()/100.0).arg(-scenePoint.x()/100.0));
|
||||
#else
|
||||
QToolTip::showText(event->globalPos(), QString("%1m %2m").arg(-scenePoint.y()/100.0).arg(-scenePoint.x()/100.0));
|
||||
#endif
|
||||
@@ -1809,6 +1809,32 @@ void GraphViewer::mouseMoveEvent(QMouseEvent * event)
|
||||
QGraphicsView::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void GraphViewer::mouseDoubleClickEvent(QMouseEvent * event)
|
||||
{
|
||||
QGraphicsItem *item = this->scene()->itemAt(mapToScene(event->pos()), QTransform());
|
||||
if(item)
|
||||
{
|
||||
NodeItem *nodeItem = qgraphicsitem_cast<NodeItem*>(item);
|
||||
LinkItem *linkItem = qgraphicsitem_cast<LinkItem*>(item);
|
||||
if(nodeItem && nodeItem->parentItem() == _graphRoot && nodeItem->id() != 0)
|
||||
{
|
||||
Q_EMIT nodeSelected(nodeItem->id());
|
||||
}
|
||||
else if(linkItem && linkItem->parentItem() == _graphRoot && linkItem->from() != 0 && linkItem->to() != 0)
|
||||
{
|
||||
Q_EMIT linkSelected(linkItem->from(), linkItem->to());
|
||||
}
|
||||
else
|
||||
{
|
||||
QGraphicsView::mouseDoubleClickEvent(event);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QGraphicsView::mouseDoubleClickEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
QIcon createIcon(const QColor & color)
|
||||
{
|
||||
QPixmap pixmap(50, 50);
|
||||
|
||||
Reference in New Issue
Block a user