Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clicking Nodes\Links brings them up in viewer #1344

Merged
merged 3 commits into from
Sep 22, 2024

Conversation

Nosille
Copy link
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
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
6 of 7 checks passed
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