mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user