I have created the QGraphicsView in the Qt dialog. Added some lines in the QGraphicsView. I want to highlight the line on mouse hover. here not getting Object of line on mouse hover to highlight.
bool QtdlUI::eventFilter(QObject* obj, QEvent* event)
{
if (event->type() == QEvent::MouseMove)
{
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
QPointF Inpos = mouseEvent->scenePosition();
QGraphicsItem* Graphicsit = Gscene->itemAt(Inpos, ui.graphicsView->transform());
}
}
I tried above code but getting QGraphicsItem null.
New contributor
Ajit is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.