git-svn-id: svn://db.shs.com.ru/libs@148 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -66,12 +66,13 @@ void BlockItemPin::hoverEnterEvent(QGraphicsSceneHoverEvent * e) {
|
|||||||
if ((state() != Disconnected) && !m_pin_mc) return;
|
if ((state() != Disconnected) && !m_pin_mc) return;
|
||||||
saveState();
|
saveState();
|
||||||
setState(BlockItemPin::Hover);
|
setState(BlockItemPin::Hover);
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BlockItemPin::hoverLeaveEvent(QGraphicsSceneHoverEvent * e) {
|
void BlockItemPin::hoverLeaveEvent(QGraphicsSceneHoverEvent * e) {
|
||||||
//if (state() == Hover)
|
|
||||||
restoreState();
|
restoreState();
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BLOCKITEM_DEFAULT_PIN_MARGIN 20
|
#define BLOCKITEM_DEFAULT_PIN_MARGIN 20
|
||||||
@@ -351,6 +352,7 @@ BlockItem * BlockItem::copy() const {
|
|||||||
np->setBusType(p->busType());
|
np->setBusType(p->busType());
|
||||||
np->setAlignment(p->alignment());
|
np->setAlignment(p->alignment());
|
||||||
np->setText(p->text());
|
np->setText(p->text());
|
||||||
|
np->setToolTip(p->toolTip());
|
||||||
np->properties() = p->properties();
|
np->properties() = p->properties();
|
||||||
ret->addPin(np);
|
ret->addPin(np);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,13 +67,13 @@ public:
|
|||||||
Direction direction() const {return dir;}
|
Direction direction() const {return dir;}
|
||||||
QString text() const {return text_item.text();}
|
QString text() const {return text_item.text();}
|
||||||
State state() const {return state_;}
|
State state() const {return state_;}
|
||||||
|
|
||||||
void setBusType(int type_) {bus_type = type_;}
|
void setBusType(int type_) {bus_type = type_;}
|
||||||
void setAlignment(Qt::Alignment a) {align = a; _init(true);}
|
void setAlignment(Qt::Alignment a) {align = a; _init(true);}
|
||||||
void setDirection(Direction d) {dir = d; _init(true);}
|
void setDirection(Direction d) {dir = d; _init(true);}
|
||||||
void setText(const QString & t) {text_item.setText(t); _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 setState(State s) {state_ = s; setBrush(br[int(state_)]); update();}
|
||||||
|
|
||||||
void saveState() {sstate_.push(state_);}
|
void saveState() {sstate_.push(state_);}
|
||||||
bool restoreState() {if (sstate_.isEmpty()) return false; setState(sstate_.pop()); return true;}
|
bool restoreState() {if (sstate_.isEmpty()) return false; setState(sstate_.pop()); return true;}
|
||||||
void clearStateStack() {sstate_.clear();}
|
void clearStateStack() {sstate_.clear();}
|
||||||
@@ -102,7 +102,7 @@ protected:
|
|||||||
Qt::Alignment align;
|
Qt::Alignment align;
|
||||||
Direction dir;
|
Direction dir;
|
||||||
QBrush br[6];
|
QBrush br[6];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ protected:
|
|||||||
|
|
||||||
inline QDataStream & operator <<(QDataStream & s, const BlockItemPin * p) {
|
inline QDataStream & operator <<(QDataStream & s, const BlockItemPin * p) {
|
||||||
ChunkStream cs;
|
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;}
|
s << cs.data(); return s;}
|
||||||
inline QDataStream & operator >>(QDataStream & s, BlockItemPin *& p) {
|
inline QDataStream & operator >>(QDataStream & s, BlockItemPin *& p) {
|
||||||
ChunkStream cs(s);
|
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 1: p->setAlignment((Qt::Alignment)cs.getData<int>()); break;
|
||||||
case 2: p->setBusType(cs.getData<int>()); break;
|
case 2: p->setBusType(cs.getData<int>()); break;
|
||||||
case 3: p->setText(cs.getData<QString>()); break;
|
case 3: p->setText(cs.getData<QString>()); break;
|
||||||
|
case 4: p->setToolTip(cs.getData<QString>()); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
|
|||||||
Reference in New Issue
Block a user