QDomElement view = xmldoc.createElement( "position" ); QPointF viewportP = ui->graphicsView->mapToScene( QPoint(0,0 ) ); view.setAttribute( "pointX", viewportP.x() ); view.setAttribute( "pointY", viewportP.y() ); QSizeF sizef = ui->graphicsView->viewport()->geometry().size(); view.setAttribute( "sizeX", sizef.width() ); view.setAttribute( "sizeY", sizef.height() ); topNod.appendChild( view );и т.д.
ui->graphicsView->ensureVisible( interface.attribute( "pointX" ).toDouble(), interface.attribute( "pointY" ).toDouble(), interface.attribute( "sizeX" ).toDouble(), interface.attribute( "sizeY" ).toDouble(), 0, 0 );
ui->graphicsView->ensureVisible( interface.attribute( "pointX" ).toDouble(), interface.attribute( "pointY" ).toDouble(), interface.attribute( "sizeX" ).toDouble(), interface.attribute( "sizeY" ).toDouble(), 0, 0 ); qDebug() << interface.attribute( "pointX" ).toDouble() << interface.attribute( "pointY" ).toDouble() << ui->graphicsView->mapToScene( QPoint(0,0 ) );