Skip to content

Commit 700a103

Browse files
committed
Improve positioning
1 parent ab79be3 commit 700a103

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Interface/Application/NetworkEditor.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,7 @@ void ErrorItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
12431243

12441244
void ErrorItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
12451245
{
1246-
timeLine_->setCurrentTime(0);
1246+
timeLine_->setCurrentTime(0);
12471247
}
12481248

12491249
void ErrorItem::animate(qreal val)
@@ -1260,13 +1260,19 @@ void NetworkEditor::displayError(const QString& msg, std::function<void()> showM
12601260
auto errorItem = new ErrorItem(msg, showModule);
12611261
scene()->addItem(errorItem);
12621262

1263-
auto rect = mapToScene(viewport()->geometry()).boundingRect();
1263+
QPointF tl(horizontalScrollBar()->value(), verticalScrollBar()->value());
1264+
QPointF br = tl + viewport()->rect().bottomRight();
1265+
QMatrix mat = matrix().inverted();
1266+
auto rect = mat.mapRect(QRectF(tl,br));
1267+
1268+
//auto rectOld = mapToScene(viewport()->geometry()).boundingRect();
12641269
//qDebug() << "scene rect:" << rect;
1270+
//qDebug() << "scene rectOld:" << rectOld;
12651271

12661272
auto corner = rect.bottomLeft();
12671273
//qDebug() << corner;
12681274

1269-
errorItem->setPos(corner + QPointF(50, -(40*errorItem->num() + 100)));
1275+
errorItem->setPos(corner + QPointF(-300, -(40*errorItem->num() + 200)));
12701276
}
12711277

12721278
NetworkEditor::~NetworkEditor()

0 commit comments

Comments
 (0)