mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
Fix mouse handles go out of sync after moving items with cursor keys
This commit is contained in:
parent
1e67ee42fa
commit
fd65c2d05a
@ -237,6 +237,11 @@ Emitted when item requests that all connected arrows are repainted.
|
||||
void updateArrowPaths();
|
||||
%Docstring
|
||||
Emitted when item requires that all connected arrow paths are recalculated.
|
||||
%End
|
||||
|
||||
void sizePositionChanged();
|
||||
%Docstring
|
||||
Emitted when the item's size or position changes.
|
||||
%End
|
||||
|
||||
protected slots:
|
||||
|
||||
@ -118,6 +118,7 @@ void QgsModelComponentGraphicItem::moveComponentBy( qreal dx, qreal dy )
|
||||
updateStoredComponentPosition( pos(), mComponent->size() );
|
||||
emit changed();
|
||||
|
||||
emit sizePositionChanged();
|
||||
emit updateArrowPaths();
|
||||
}
|
||||
|
||||
@ -141,6 +142,7 @@ void QgsModelComponentGraphicItem::setItemRect( QRectF )
|
||||
|
||||
emit changed();
|
||||
|
||||
emit sizePositionChanged();
|
||||
emit updateArrowPaths();
|
||||
}
|
||||
|
||||
|
||||
@ -275,6 +275,11 @@ class GUI_EXPORT QgsModelComponentGraphicItem : public QGraphicsObject
|
||||
*/
|
||||
void updateArrowPaths();
|
||||
|
||||
/**
|
||||
* Emitted when the item's size or position changes.
|
||||
*/
|
||||
void sizePositionChanged();
|
||||
|
||||
protected slots:
|
||||
|
||||
/**
|
||||
|
||||
@ -53,6 +53,24 @@ void QgsModelViewMouseHandles::paint( QPainter *painter, const QStyleOptionGraph
|
||||
|
||||
void QgsModelViewMouseHandles::selectionChanged()
|
||||
{
|
||||
//listen out for selected items' size and rotation changed signals
|
||||
const QList<QGraphicsItem *> itemList = mView->items();
|
||||
for ( QGraphicsItem *graphicsItem : itemList )
|
||||
{
|
||||
QgsModelComponentGraphicItem *item = dynamic_cast<QgsModelComponentGraphicItem *>( graphicsItem );
|
||||
if ( !item )
|
||||
continue;
|
||||
|
||||
if ( item->isSelected() )
|
||||
{
|
||||
connect( item, &QgsModelComponentGraphicItem::sizePositionChanged, this, &QgsModelViewMouseHandles::selectedItemSizeChanged );
|
||||
}
|
||||
else
|
||||
{
|
||||
disconnect( item, &QgsModelComponentGraphicItem::sizePositionChanged, this, &QgsModelViewMouseHandles::selectedItemSizeChanged );
|
||||
}
|
||||
}
|
||||
|
||||
resetStatusBar();
|
||||
updateHandles();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user