私の問題は、値を QPointF に設定しているときに、それらが実際に何であるかを確認すると、1.32841e+09 のような奇妙な値が得られることです。while ループの 6 行目に出力すると、これらの値が得られません。
void MainView::showAllGraphs(){
QMapIterator<QString, QRectF> i(graphRectangles);
QPointF topLeft;
QPointF bottomRight;
QRectF maxRect;
while (i.hasNext()) {
i.next();
qreal tlX = i.value().topLeft().x();
qreal tlY = i.value().topLeft().y();
qreal brX = i.value().bottomRight().x();
qreal brY = i.value().bottomRight().y();
QTextStream(stdout) << tlY << " " << brY << endl;
if(tlY < topLeft.y()){
topLeft.setY(tlY);
topLeft.setX(tlX);
}
if(brY > bottomRight.y()){
bottomRight.setY(brY);
bottomRight.setX(brX);
}
}
maxRect.setTopLeft(topLeft);
maxRect.setBottomRight(bottomRight);
QTextStream(stdout) << topLeft.y() << " x " << topLeft.y() << endl;
graphicsScene>setSceneRect(maxRect);
graphicsView->fitInView(maxRect);
matrixUpdated(graphicsView->matrix());
}
最初の印刷では、-100 から 100 の間の値を取得します (これは有効です)。最後に印刷すると、突然 2.45841e+09 または 0 のような値が表示されます。それを変更したくありません。
では、この価値の変化の理由は何でしょうか?なぜそのような値に設定されているのかわかりません。