mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-30 15:50:52 +01:00
Merge branch 'terminal_strip'
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