git-svn-id: svn://db.shs.com.ru/libs@315 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2017-11-09 17:59:47 +00:00
parent bc2cc255b3
commit efeb95c1c3
4 changed files with 20 additions and 0 deletions

View File

@@ -445,6 +445,17 @@ void BlockItem::mouseMoveEvent(QGraphicsSceneMouseEvent * event) {
//QGraphicsItem::mouseMoveEvent(event);
}
void BlockItem::hoverEnterEvent(QGraphicsSceneHoverEvent * e) {
emit blockHoverEnter(this);
}
void BlockItem::hoverLeaveEvent(QGraphicsSceneHoverEvent * e) {
emit blockHoverLeave(this);
}
#define _POS(m) (i - ((cp.size() - 1) / 2)) * m
void BlockItem::arrangePins() {

View File

@@ -161,6 +161,8 @@ protected:
int type() const {return Type;}
QRectF boundingRect() const;
void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
void hoverEnterEvent(QGraphicsSceneHoverEvent * event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent * event);
double left() const {return boundingRect().left();}
double right() const {return boundingRect().right();}
double top() const {return boundingRect().top();}
@@ -174,6 +176,9 @@ protected:
QMap<Qt::Alignment, QVector<BlockItemPin * > > pins_;
QList<QGraphicsItem * > decors_;
signals:
void blockHoverEnter(BlockItem * b);
void blockHoverLeave(BlockItem * b);
};

View File

@@ -823,6 +823,8 @@ void BlockView::addItem(QGraphicsItem * item) {
}
if (item->data(1006) == "item") {
connect((BlockItem*)item, SIGNAL(destroyed(QObject*)), this, SLOT(removedBlock(QObject*)), Qt::UniqueConnection);
connect((BlockItem*)item, SIGNAL(blockHoverEnter(BlockItem*)), this, SIGNAL(blockHoverEnter(BlockItem*)), Qt::UniqueConnection);
connect((BlockItem*)item, SIGNAL(blockHoverLeave(BlockItem*)), this, SIGNAL(blockHoverLeave(BlockItem*)), Qt::UniqueConnection);
emitActionEvent(BlockItemBase::BlockAdd, QList<QGraphicsItem*>() << item);
return;
}

View File

@@ -207,6 +207,8 @@ public slots:
signals:
void blockDoubleClicked(BlockItem * );
void blockHoverEnter(BlockItem * );
void blockHoverLeave(BlockItem * );
void busDoubleClicked(BlockBusItem * );
void schemeAction(BlockItemBase::Action action, QList<QGraphicsItem * > items);
void blockRemoved(BlockItem * item);