updateModel( true, false );
}
+//=================================================================================
+// function : resizeEvent()
+// purpose : reimplemented from QGraphicsView::resizeEvent()
+//=================================================================================
+void DependencyTree_View::resizeEvent(QResizeEvent *event)
+{
+ QPointF aCenter = mapToScene( event->oldSize().width()/2,
+ event->oldSize().height()/2 );
+ QGraphicsView::resizeEvent( event );
+ centerOn( aCenter.x(),aCenter.y() );
+}
+
//=================================================================================
// function : onUpdateModel()
// purpose : slot for updating tree model for main objects in viewer
return;
drawTree();
- fitAll();
+ fitWindow();
}
//=================================================================================
}
}
+//=================================================================================
+// function : fitWindow()
+// purpose : scale the window considering a size of scene
+//=================================================================================
+void DependencyTree_View::fitWindow()
+{
+ int sizeFactor = 4;
+ if( objectsBoundingRect(true).width() > sizeFactor*size().width() ||
+ objectsBoundingRect(true).height() > sizeFactor*size().width() ) {
+ QRectF aRect = QRectF( -sizeFactor*size().width()/2, -sizeFactor*size().height()/2,
+ sizeFactor*size().width(), sizeFactor*size().height() );
+ fitInView( aRect, Qt::KeepAspectRatio );
+ }
+ else
+ fitAll();
+}
+
//=================================================================================
// function : getNewTreeModel()
// purpose : get dependency tree model from engine