Skip to content

Clicking Nodes\Links brings them up in viewer#1344

Merged
matlabbe merged 3 commits intointrolab:masterfrom
Nosille:NodesLinksClickable
Sep 22, 2024
Merged

Clicking Nodes\Links brings them up in viewer#1344
matlabbe merged 3 commits intointrolab:masterfrom
Nosille:NodesLinksClickable

Conversation

@Nosille
Copy link
Copy Markdown
Contributor

@Nosille Nosille commented Sep 17, 2024

I added the ability to mouse click on nodes and links in the graph view and have them populate slider_A and slider_B in the main view window.

@matlabbe
Copy link
Copy Markdown
Member

That feature already existed here:

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);
}
}

but it was on double-click. I tried your PR and it feels better with single-click. I modified the PR to use single-click now. I also kept your spin boxes next to the main slider bars, which are indeed useful. I merged the spin box with the index label, as they represented the same function:

Screenshot from 2024-09-21 17-39-48

I removed the code about "highlighting" option, which seemed not used anywhere. The border context menu option also crashed when clicking on it, so I removed it. I suggest to open another MR if there was a new feature there that could be useful to keep.

I'll merge now with those changes.

@matlabbe matlabbe merged commit 21abddd into introlab:master Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants