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

This commit is contained in:
2016-12-03 23:43:50 +00:00
parent a85a1a8f31
commit 1f0efdec0f
2 changed files with 8 additions and 5 deletions

View File

@@ -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);
}

View File

@@ -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<int>()); break;
case 2: p->setBusType(cs.getData<int>()); break;
case 3: p->setText(cs.getData<QString>()); break;
case 4: p->setToolTip(cs.getData<QString>()); break;
}
}
return s;