mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-26 17:30:35 +05:00
0022379: EDF 2276 GEOM: Dependency Tree - added resize event for view and new method of showing tree considering a size of scene
This commit is contained in:
parent
a4c91f0893
commit
5bc218e9c8
@ -351,6 +351,18 @@ void DependencyTree_View::onRebuildModel()
|
|||||||
updateModel( true, false );
|
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()
|
// function : onUpdateModel()
|
||||||
// purpose : slot for updating tree model for main objects in viewer
|
// purpose : slot for updating tree model for main objects in viewer
|
||||||
@ -689,7 +701,7 @@ void DependencyTree_View::updateView()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
drawTree();
|
drawTree();
|
||||||
fitAll();
|
fitWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -734,6 +746,23 @@ void DependencyTree_View::clearView( bool isClearModel )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// 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()
|
// function : getNewTreeModel()
|
||||||
// purpose : get dependency tree model from engine
|
// purpose : get dependency tree model from engine
|
||||||
|
@ -68,6 +68,10 @@ public slots:
|
|||||||
|
|
||||||
void onRebuildModel();
|
void onRebuildModel();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void resizeEvent( QResizeEvent *event );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void onUpdateModel();
|
void onUpdateModel();
|
||||||
@ -93,6 +97,8 @@ private:
|
|||||||
void updateView();
|
void updateView();
|
||||||
void clearView( bool );
|
void clearView( bool );
|
||||||
|
|
||||||
|
void fitWindow();
|
||||||
|
|
||||||
int checkMaxLevelsNumber();
|
int checkMaxLevelsNumber();
|
||||||
|
|
||||||
void getNewTreeModel( bool = true, bool = true );
|
void getNewTreeModel( bool = true, bool = true );
|
||||||
|
Loading…
Reference in New Issue
Block a user