git-svn-id: svn://db.shs.com.ru/libs@402 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -125,6 +125,13 @@ void BlockItemPin::_reparent() {
|
||||
}
|
||||
|
||||
|
||||
QGraphicsView * BlockItemPin::_view() const {
|
||||
if (!scene()) return 0;
|
||||
if (scene()->views().isEmpty()) return 0;
|
||||
return scene()->views().back();
|
||||
}
|
||||
|
||||
|
||||
QVariant BlockItemPin::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant & value) {
|
||||
if (change == QGraphicsItem::ItemParentChange)
|
||||
_reparent();
|
||||
@@ -133,9 +140,12 @@ QVariant BlockItemPin::itemChange(QGraphicsItem::GraphicsItemChange change, cons
|
||||
|
||||
|
||||
void BlockItemPin::hoverEnterEvent(QGraphicsSceneHoverEvent * e) {
|
||||
QGraphicsView * v = _view();
|
||||
bool m_pin_mc = false;
|
||||
if (scene()) if (!scene()->views().isEmpty())
|
||||
QMetaObject::invokeMethod(scene()->views().back(), "getPinMC", Q_ARG(bool*, &m_pin_mc));
|
||||
if (v) {
|
||||
QMetaObject::invokeMethod(v, "getPinMC", Q_ARG(bool*, &m_pin_mc));
|
||||
QMetaObject::invokeMethod(v, "pinHoverInOut", Qt::QueuedConnection, Q_ARG(BlockItemPin*, this));
|
||||
}
|
||||
if ((state() != Disconnected) && !m_pin_mc) return;
|
||||
saveState();
|
||||
setState(BlockItemPin::Hover);
|
||||
@@ -145,8 +155,9 @@ void BlockItemPin::hoverEnterEvent(QGraphicsSceneHoverEvent * e) {
|
||||
|
||||
|
||||
void BlockItemPin::hoverLeaveEvent(QGraphicsSceneHoverEvent * e) {
|
||||
QGraphicsView * v = _view();
|
||||
restoreState();
|
||||
enlargePin(false);
|
||||
update();
|
||||
if (v) QMetaObject::invokeMethod(v, "pinHoverInOut", Q_ARG(BlockItemPin*, 0));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user