Terminal strip Xref is clickable

When user hover the Xref string of a terminal, the string color change
to blue to advise user the xref is clickable. Double click on the blue
Xref go the folio of the terminal and zoom the view to the terminal.
This commit is contained in:
joshua
2025-10-14 22:12:38 +02:00
parent f0ec416a91
commit 7e5d41b474
8 changed files with 186 additions and 9 deletions

View File

@@ -24,12 +24,31 @@
Default constructor
@param parent : Parent Item
*/
void QetGraphicsItem::showItem(QetGraphicsItem *item)
{
if (item && item->diagram())
{
item->diagram()->showMe();
item->setSelected(true);
//Zoom to the item
for(QGraphicsView *view : item->scene()->views())
{
QRectF fit = item->sceneBoundingRect();
fit.adjust(-200, -200, 200, 200);
view->fitInView(fit, Qt::KeepAspectRatioByExpanding);
}
}
}
QetGraphicsItem::QetGraphicsItem(QGraphicsItem *parent):
QGraphicsObject(parent),
is_movable_(true),
m_first_move(true),
snap_to_grid_(true)
{}
{
setAcceptHoverEvents(true);
}
QetGraphicsItem::~QetGraphicsItem()
{}
@@ -68,6 +87,11 @@ bool QetGraphicsItem::isHovered() const {
return m_hovered;
}
QPointF QetGraphicsItem::hoverMousePos() const
{
return m_mouse_hover_pos;
}
/**
@brief QetGraphicsItem::state
@return the current state of this item
@@ -166,6 +190,12 @@ void QetGraphicsItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
QGraphicsObject::hoverEnterEvent(event);
}
void QetGraphicsItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
QGraphicsObject::hoverMoveEvent(event);
m_mouse_hover_pos = event->pos();
}
void QetGraphicsItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
m_hovered = false;