new BlockView::newBusFinished

This commit is contained in:
2023-04-13 18:21:21 +03:00
parent dc91237545
commit 94c1c73642
5 changed files with 125 additions and 53 deletions

View File

@@ -36,6 +36,48 @@ BlockItemPin::BlockItemPin(Qt::Alignment a, int bus_type_, const QString & text_
}
void BlockItemPin::setPen(const QPen & p) {
ell_item.setPen(p);
}
QPen BlockItemPin::pen() const {
return ell_item.pen();
}
void BlockItemPin::setBrush(const QBrush & b) {
ell_item.setBrush(b);
}
QBrush BlockItemPin::brush() const {
return ell_item.brush();
}
QString BlockItemPin::text() const {
return text_item.text();
}
void BlockItemPin::setBusType(int type_) {
bus_type = type_;
}
void BlockItemPin::setAlignment(Qt::Alignment a) {
align = a;
_init(true);
}
void BlockItemPin::setText(const QString & t) {
text_item.setText(t);
_init(true);
}
void BlockItemPin::animAccept() {
if (!((BlockView *)scene()->views().back())->isBlockAnimationEnabled() && anim_accept.state() != QAbstractAnimation::Running) return;
anim_accept.setStartValue(pinSize());
@@ -44,6 +86,11 @@ void BlockItemPin::animAccept() {
}
QRectF BlockItemPin::boundingRect() const {
return ell_item.boundingRect().translated(ell_item.pos()) | text_item.boundingRect().translated(text_item.pos());
}
void BlockItemPin::setState(State s) {
State os = state_;
state_ = s;
@@ -55,6 +102,23 @@ void BlockItemPin::setState(State s) {
}
void BlockItemPin::saveState() {
sstate_.push(state_);
}
bool BlockItemPin::restoreState() {
if (sstate_.isEmpty()) return false;
setState(sstate_.pop());
return true;
}
void BlockItemPin::clearStateStack() {
sstate_.clear();
}
void BlockItemPin::enlargePin(bool enlarge) {
double sz = enlarge ? 12. : 7;
if (anim_accept.state() == QAbstractAnimation::Running && enlarge) {