diff --git a/qad_blockview/blockitem.cpp b/qad_blockview/blockitem.cpp index 7442dab..68c4eef 100644 --- a/qad_blockview/blockitem.cpp +++ b/qad_blockview/blockitem.cpp @@ -66,12 +66,13 @@ void BlockItemPin::hoverEnterEvent(QGraphicsSceneHoverEvent * e) { if ((state() != Disconnected) && !m_pin_mc) return; saveState(); setState(BlockItemPin::Hover); + update(); } void BlockItemPin::hoverLeaveEvent(QGraphicsSceneHoverEvent * e) { - //if (state() == Hover) restoreState(); + update(); } #define BLOCKITEM_DEFAULT_PIN_MARGIN 20 @@ -351,6 +352,7 @@ BlockItem * BlockItem::copy() const { np->setBusType(p->busType()); np->setAlignment(p->alignment()); np->setText(p->text()); + np->setToolTip(p->toolTip()); np->properties() = p->properties(); ret->addPin(np); } diff --git a/qad_blockview/blockitem.h b/qad_blockview/blockitem.h index 05c31cf..a0b70da 100644 --- a/qad_blockview/blockitem.h +++ b/qad_blockview/blockitem.h @@ -67,13 +67,13 @@ public: Direction direction() const {return dir;} QString text() const {return text_item.text();} State state() const {return state_;} - + void setBusType(int type_) {bus_type = type_;} void setAlignment(Qt::Alignment a) {align = a; _init(true);} void setDirection(Direction d) {dir = d; _init(true);} void setText(const QString & t) {text_item.setText(t); _init(true);} void setState(State s) {state_ = s; setBrush(br[int(state_)]); update();} - + void saveState() {sstate_.push(state_);} bool restoreState() {if (sstate_.isEmpty()) return false; setState(sstate_.pop()); return true;} void clearStateStack() {sstate_.clear();} @@ -102,7 +102,7 @@ protected: Qt::Alignment align; Direction dir; QBrush br[6]; - + }; @@ -176,7 +176,7 @@ protected: inline QDataStream & operator <<(QDataStream & s, const BlockItemPin * p) { ChunkStream cs; - cs << cs.chunk(1, int(p->alignment())) << cs.chunk(2, p->busType()) << cs.chunk(3, p->text()); + cs << cs.chunk(1, int(p->alignment())) << cs.chunk(2, p->busType()) << cs.chunk(3, p->text()) << cs.chunk(4, p->toolTip()); s << cs.data(); return s;} inline QDataStream & operator >>(QDataStream & s, BlockItemPin *& p) { ChunkStream cs(s); @@ -186,6 +186,7 @@ inline QDataStream & operator >>(QDataStream & s, BlockItemPin *& p) { case 1: p->setAlignment((Qt::Alignment)cs.getData()); break; case 2: p->setBusType(cs.getData()); break; case 3: p->setText(cs.getData()); break; + case 4: p->setToolTip(cs.getData()); break; } } return s;