git-svn-id: svn://db.shs.com.ru/libs@311 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -730,6 +730,6 @@ void BlockBusItem::paint(QPainter * p, const QStyleOptionGraphicsItem * o, QWidg
|
||||
|
||||
QRectF BlockBusItem::boundingRect() const {
|
||||
QPolygonF p(pol);
|
||||
p << new_end;
|
||||
if (new_segment) p << new_end;
|
||||
return enlargedRect(p.boundingRect(), 0, 0, 10.f);
|
||||
}
|
||||
|
||||
@@ -1000,6 +1000,25 @@ void BlockView::fitInView(const QGraphicsItem * item, Qt::AspectRatioMode aspect
|
||||
}
|
||||
|
||||
|
||||
QRectF BlockView::itemsBoundingRect() const {
|
||||
QList<QGraphicsItem*> gi = scene_->items();
|
||||
if (gi.isEmpty()) return QRectF();
|
||||
bool f = true;
|
||||
QRectF ret;
|
||||
foreach (QGraphicsItem * i, gi)
|
||||
if (i->isVisible() && (i != &tmp_bus)) {
|
||||
if ((i->data(1007) != "item_selection") && !i->data(1008).toBool()) {
|
||||
QRectF br = i->mapRectToScene(i->boundingRect());
|
||||
//qDebug() << i << br;
|
||||
if (f) ret = br;
|
||||
else ret |= br;
|
||||
f = false;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void BlockView::restoreSelState() {
|
||||
foreach (QGraphicsItem * i, sel_items) {
|
||||
i->setPos(i->data(1001).toPointF());
|
||||
|
||||
@@ -82,6 +82,8 @@ public:
|
||||
void fitInView(qreal x, qreal y, qreal w, qreal h, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio);
|
||||
void fitInView(const QGraphicsItem * item, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio);
|
||||
|
||||
QRectF itemsBoundingRect() const;
|
||||
|
||||
protected:
|
||||
void _init();
|
||||
void _updateBack();
|
||||
|
||||
Reference in New Issue
Block a user