Skip to content
Permalink
Browse files
fix api break for pointChanged. use pointChangedV2
  • Loading branch information
lbartoletti authored and nyalldawson committed Sep 12, 2021
1 parent 99af22b commit f4383aaa5bb73361d73c5c467e4d140c412dfcb7
@@ -510,12 +510,25 @@ Push a warning
Remove any previously emitted warnings (if any)
%End

void pointChanged( const QgsPoint &point );
void pointChangedV2( const QgsPoint &point );
%Docstring
Sometimes a constraint may change the current point out of a mouse event. This happens normally
when a constraint is toggled.

:param point: The last known digitizing point. Can be used to emulate a mouse event.

.. versionadded:: 3.22
%End

void pointChanged( const QgsPointXY &point ) /Deprecated/;
%Docstring
Sometimes a constraint may change the current point out of a mouse event. This happens normally
when a constraint is toggled.

:param point: The last known digitizing point. Can be used to emulate a mouse event.

.. deprecated:: QGIS 3.22
- No longer used, will be removed in QGIS 4.0. Use the variant which emits :py:class:`QgsPoint` object instead of :py:class:`QgsPointXY`.
%End


@@ -591,7 +591,7 @@ void QgsAdvancedDigitizingDockWidget::updateConstraintValue( CadConstraint *cons

constraint->setValue( value, convertExpression );
// run a fake map mouse event to update the paint item
emit pointChanged( mCadPointList.value( 0 ) );
emit pointChangedV2( mCadPointList.value( 0 ) );
}

void QgsAdvancedDigitizingDockWidget::lockConstraint( bool activate /* default true */ )
@@ -659,7 +659,7 @@ void QgsAdvancedDigitizingDockWidget::lockConstraint( bool activate /* default t
}

// run a fake map mouse event to update the paint item
emit pointChanged( mCadPointList.value( 0 ) );
emit pointChangedV2( mCadPointList.value( 0 ) );
}
}

@@ -1162,7 +1162,7 @@ bool QgsAdvancedDigitizingDockWidget::filterKeyPress( QKeyEvent *e )
{
mXConstraint->toggleLocked();
emit lockXChanged( mXConstraint->isLocked() );
emit pointChanged( mCadPointList.value( 0 ) );
emit pointChangedV2( mCadPointList.value( 0 ) );
e->accept();
}
else if ( type == QEvent::ShortcutOverride && e->modifiers() == Qt::ShiftModifier )
@@ -1171,7 +1171,7 @@ bool QgsAdvancedDigitizingDockWidget::filterKeyPress( QKeyEvent *e )
{
mXConstraint->toggleRelative();
emit relativeXChanged( mXConstraint->relative() );
emit pointChanged( mCadPointList.value( 0 ) );
emit pointChangedV2( mCadPointList.value( 0 ) );
e->accept();
}
}
@@ -1192,7 +1192,7 @@ bool QgsAdvancedDigitizingDockWidget::filterKeyPress( QKeyEvent *e )
{
mYConstraint->toggleLocked();
emit lockYChanged( mYConstraint->isLocked() );
emit pointChanged( mCadPointList.value( 0 ) );
emit pointChangedV2( mCadPointList.value( 0 ) );
e->accept();
}
else if ( type == QEvent::ShortcutOverride && e->modifiers() == Qt::ShiftModifier )
@@ -1201,7 +1201,7 @@ bool QgsAdvancedDigitizingDockWidget::filterKeyPress( QKeyEvent *e )
{
mYConstraint->toggleRelative();
emit relativeYChanged( mYConstraint->relative() );
emit pointChanged( mCadPointList.value( 0 ) );
emit pointChangedV2( mCadPointList.value( 0 ) );
e->accept();
}
}
@@ -1222,7 +1222,7 @@ bool QgsAdvancedDigitizingDockWidget::filterKeyPress( QKeyEvent *e )
{
mZConstraint->toggleLocked();
emit lockZChanged( mZConstraint->isLocked() );
emit pointChanged( mCadPointList.value( 0 ) );
emit pointChangedV2( mCadPointList.value( 0 ) );
e->accept();
}
else if ( type == QEvent::ShortcutOverride && e->modifiers() == Qt::ShiftModifier )
@@ -1231,7 +1231,7 @@ bool QgsAdvancedDigitizingDockWidget::filterKeyPress( QKeyEvent *e )
{
mZConstraint->toggleRelative();
emit relativeZChanged( mZConstraint->relative() );
emit pointChanged( mCadPointList.value( 0 ) );
emit pointChangedV2( mCadPointList.value( 0 ) );
e->accept();
}
}
@@ -1252,7 +1252,7 @@ bool QgsAdvancedDigitizingDockWidget::filterKeyPress( QKeyEvent *e )
{
mMConstraint->toggleLocked();
emit lockMChanged( mMConstraint->isLocked() );
emit pointChanged( mCadPointList.value( 0 ) );
emit pointChangedV2( mCadPointList.value( 0 ) );
e->accept();
}
else if ( type == QEvent::ShortcutOverride && e->modifiers() == Qt::ShiftModifier )
@@ -1261,7 +1261,7 @@ bool QgsAdvancedDigitizingDockWidget::filterKeyPress( QKeyEvent *e )
{
mMConstraint->toggleRelative();
emit relativeMChanged( mMConstraint->relative() );
emit pointChanged( mCadPointList.value( 0 ) );
emit pointChangedV2( mCadPointList.value( 0 ) );
e->accept();
}
}
@@ -1284,7 +1284,7 @@ bool QgsAdvancedDigitizingDockWidget::filterKeyPress( QKeyEvent *e )
{
mAngleConstraint->toggleLocked();
emit lockAngleChanged( mAngleConstraint->isLocked() );
emit pointChanged( mCadPointList.value( 0 ) );
emit pointChangedV2( mCadPointList.value( 0 ) );
e->accept();
}
}
@@ -1294,7 +1294,7 @@ bool QgsAdvancedDigitizingDockWidget::filterKeyPress( QKeyEvent *e )
{
mAngleConstraint->toggleRelative();
emit relativeAngleChanged( mAngleConstraint->relative() );
emit pointChanged( mCadPointList.value( 0 ) );
emit pointChangedV2( mCadPointList.value( 0 ) );
e->accept();
}
}
@@ -1317,7 +1317,7 @@ bool QgsAdvancedDigitizingDockWidget::filterKeyPress( QKeyEvent *e )
{
mDistanceConstraint->toggleLocked();
emit lockDistanceChanged( mDistanceConstraint->isLocked() );
emit pointChanged( mCadPointList.value( 0 ) );
emit pointChangedV2( mCadPointList.value( 0 ) );
e->accept();
}
}
@@ -1362,7 +1362,7 @@ bool QgsAdvancedDigitizingDockWidget::filterKeyPress( QKeyEvent *e )
e->accept();

// run a fake map mouse event to update the paint item
emit pointChanged( mCadPointList.value( 0 ) );
emit pointChangedV2( mCadPointList.value( 0 ) );
}
break;
}
@@ -493,8 +493,18 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private
* when a constraint is toggled.
*
* \param point The last known digitizing point. Can be used to emulate a mouse event.
* \since QGIS 3.22
*/
void pointChangedV2( const QgsPoint &point );

/**
* Sometimes a constraint may change the current point out of a mouse event. This happens normally
* when a constraint is toggled.
*
* \param point The last known digitizing point. Can be used to emulate a mouse event.
* \deprecated since QGIS 3.22 - No longer used, will be removed in QGIS 4.0. Use the variant which emits QgsPoint object instead of QgsPointXY.
*/
void pointChanged( const QgsPoint &point );
Q_DECL_DEPRECATED void pointChanged( const QgsPointXY &point ) SIP_DEPRECATED;

//! Signals for external widgets that need to update according to current values

@@ -121,7 +121,7 @@ void QgsMapToolAdvancedDigitizing::canvasMoveEvent( QgsMapMouseEvent *e )
void QgsMapToolAdvancedDigitizing::activate()
{
QgsMapToolEdit::activate();
connect( mCadDockWidget, &QgsAdvancedDigitizingDockWidget::pointChanged, this, &QgsMapToolAdvancedDigitizing::cadPointChanged );
connect( mCadDockWidget, &QgsAdvancedDigitizingDockWidget::pointChangedV2, this, &QgsMapToolAdvancedDigitizing::cadPointChanged );
mCadDockWidget->enable();
mSnapToGridCanvasItem = new QgsSnapToGridCanvasItem( mCanvas );
QgsVectorLayer *layer = currentVectorLayer();
@@ -136,7 +136,7 @@ void QgsMapToolAdvancedDigitizing::activate()
void QgsMapToolAdvancedDigitizing::deactivate()
{
QgsMapToolEdit::deactivate();
disconnect( mCadDockWidget, &QgsAdvancedDigitizingDockWidget::pointChanged, this, &QgsMapToolAdvancedDigitizing::cadPointChanged );
disconnect( mCadDockWidget, &QgsAdvancedDigitizingDockWidget::pointChangedV2, this, &QgsMapToolAdvancedDigitizing::cadPointChanged );
mCadDockWidget->disable();
delete mSnapToGridCanvasItem;
mSnapToGridCanvasItem = nullptr;

0 comments on commit f4383aa

Please sign in to comment.