Adress comments

This commit is contained in:
Valentin Buira 2025-05-13 22:37:09 +02:00 committed by Nyall Dawson
parent 082f82baab
commit 10897ff3a9
6 changed files with 18 additions and 20 deletions

View File

@ -87,14 +87,16 @@ Returns the current combination of flags set for the scene.
virtual void mousePressEvent( QGraphicsSceneMouseEvent *event );
QRectF modelBounds( double margin ) const;
QRectF modelBounds( double margin = 0.0 ) const;
%Docstring
Calculates the bouding bounds of all components of the model.
Calculates the bounding rectangle of all components of the model.
:param margin: optional marginal ( absolute value in scene coordinate)
to add around items
:param margin: optional margin (absolute value in scene coordinates) to
add around items.
:return: model bounds, in scene units.
.. versionadded:: 3.44
%End

View File

@ -87,14 +87,16 @@ Returns the current combination of flags set for the scene.
virtual void mousePressEvent( QGraphicsSceneMouseEvent *event );
QRectF modelBounds( double margin ) const;
QRectF modelBounds( double margin = 0.0 ) const;
%Docstring
Calculates the bouding bounds of all components of the model.
Calculates the bounding rectangle of all components of the model.
:param margin: optional marginal ( absolute value in scene coordinate)
to add around items
:param margin: optional margin (absolute value in scene coordinates) to
add around items.
:return: model bounds, in scene units.
.. versionadded:: 3.44
%End

View File

@ -75,11 +75,8 @@ QRectF QgsModelGraphicsScene::modelBounds( double margin ) const
for ( QGraphicsItem *item : constItems )
{
QgsModelComponentGraphicItem *componentItem = dynamic_cast<QgsModelComponentGraphicItem *>( item );
if ( !componentItem )
{
continue;
}
bounds = bounds.united( componentItem->sceneBoundingRect() );
if ( componentItem )
bounds = bounds.united( componentItem->sceneBoundingRect() );
}
if ( bounds.isValid() && margin > 0.0 )

View File

@ -99,12 +99,12 @@ class GUI_EXPORT QgsModelGraphicsScene : public QGraphicsScene
void mousePressEvent( QGraphicsSceneMouseEvent *event ) override;
/**
* Calculates the bouding bounds of all components of the model.
* \param margin optional marginal ( absolute value in scene coordinate) to add around items
* Calculates the bounding rectangle of all components of the model.
* \param margin optional margin (absolute value in scene coordinates) to add around items.
* \returns model bounds, in scene units.
*
* \since QGIS 3.44
*/
QRectF modelBounds( double margin ) const;
QRectF modelBounds( double margin = 0.0 ) const;
/**

View File

@ -397,7 +397,6 @@ void QgsModelGraphicsView::setModelScene( QgsModelGraphicsScene *scene )
{
setScene( scene );
mPreviousSceneRect = sceneRect();
// IMPORTANT!
// previous snap markers, snap lines are owned by previous layout - so don't delete them here!
mSnapMarker = new QgsModelViewSnapMarker();

View File

@ -244,8 +244,6 @@ class GUI_EXPORT QgsModelGraphicsView : public QGraphicsView
QgsModelSnapper mSnapper;
QgsModelViewSnapMarker *mSnapMarker = nullptr;
QRectF mPreviousSceneRect;
};