Skip to content

Commit 8fe1271

Browse files
olivierdalangm-kuhn
authored andcommittedJun 11, 2019
[cad] fix graphical glitches
1 parent dc84c87 commit 8fe1271

6 files changed

+31
-3
lines changed
 

‎python/gui/auto_generated/qgsadvanceddigitizingdockwidget.sip.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,13 @@ Removes all points from the CAD point list
264264
Adds point to the CAD point list
265265

266266
.. versionadded:: 3.0
267+
%End
268+
269+
void removePreviousPoint();
270+
%Docstring
271+
Remove previous point in the CAD point list
272+
273+
.. versionadded:: 3.8
267274
%End
268275

269276
void setPoints( const QList<QgsPointXY> &points );

‎python/gui/auto_generated/qgsmaptooladvanceddigitizing.sip.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ This method is protected because it should be a decision of the map tool and not
117117
.. versionadded:: 3.0
118118
%End
119119

120+
121+
120122
public:
121123

122124
virtual void cadCanvasPressEvent( QgsMapMouseEvent *e );

‎src/gui/qgsadvanceddigitizingdockwidget.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,7 @@ void QgsAdvancedDigitizingDockWidget::addPoint( const QgsPointXY &point )
10201020
}
10211021

10221022
updateCapacity();
1023+
updateCadPaintItem();
10231024
}
10241025

10251026
void QgsAdvancedDigitizingDockWidget::removePreviousPoint()
@@ -1030,6 +1031,7 @@ void QgsAdvancedDigitizingDockWidget::removePreviousPoint()
10301031
int i = pointsCount() > 1 ? 1 : 0;
10311032
mCadPointList.removeAt( i );
10321033
updateCapacity();
1034+
updateCadPaintItem();
10331035
}
10341036

10351037
void QgsAdvancedDigitizingDockWidget::clearPoints()
@@ -1038,6 +1040,7 @@ void QgsAdvancedDigitizingDockWidget::clearPoints()
10381040
mSnappedSegment.clear();
10391041

10401042
updateCapacity();
1043+
updateCadPaintItem();
10411044
}
10421045

10431046
void QgsAdvancedDigitizingDockWidget::updateCurrentPoint( const QgsPointXY &point )
@@ -1051,6 +1054,7 @@ void QgsAdvancedDigitizingDockWidget::updateCurrentPoint( const QgsPointXY &poin
10511054
{
10521055
mCadPointList[0] = point;
10531056
}
1057+
updateCadPaintItem();
10541058
}
10551059

10561060

‎src/gui/qgsadvanceddigitizingdockwidget.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,12 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private
278278
*/
279279
void addPoint( const QgsPointXY &point );
280280

281+
/**
282+
* Remove previous point in the CAD point list
283+
* \since QGIS 3.8
284+
*/
285+
void removePreviousPoint();
286+
281287
/**
282288
* Configures list of current CAD points
283289
*
@@ -426,8 +432,7 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private
426432

427433
//! update the current point in the CAD point list
428434
void updateCurrentPoint( const QgsPointXY &point );
429-
//! remove previous point in the CAD point list
430-
void removePreviousPoint();
435+
431436

432437
/**
433438
* filters key press

‎src/gui/qgsmaptooladvanceddigitizing.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ class GUI_EXPORT QgsMapToolAdvancedDigitizing : public QgsMapToolEdit
107107
*/
108108
void setAutoSnapEnabled( bool enabled ) { mAutoSnapEnabled = enabled; }
109109

110+
111+
QgsAdvancedDigitizingDockWidget *mCadDockWidget = nullptr;
112+
110113
public:
111114

112115
/**
@@ -172,7 +175,6 @@ class GUI_EXPORT QgsMapToolAdvancedDigitizing : public QgsMapToolEdit
172175
void onCurrentLayerChanged();
173176

174177
private:
175-
QgsAdvancedDigitizingDockWidget *mCadDockWidget = nullptr;
176178

177179
//! Whether to allow use of advanced digitizing dock at this point
178180
bool mAdvancedDigitizingAllowed = true;

‎src/gui/qgsmaptoolcapture.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include "qgsvectorlayer.h"
3131
#include "qgsvertexmarker.h"
3232
#include "qgssettings.h"
33+
#include "qgsapplication.h"
34+
#include "qgsadvanceddigitizingdockwidget.h"
3335

3436
#include <QAction>
3537
#include <QCursor>
@@ -584,6 +586,12 @@ void QgsMapToolCapture::undo()
584586
mCaptureCurve.deleteVertex( vertexToRemove );
585587
mSnappingMatches.removeAt( vertexToRemove.vertex );
586588

589+
// If Cad is enabled, update the points accordingly
590+
if ( mCadDockWidget->cadEnabled() )
591+
{
592+
mCadDockWidget->removePreviousPoint();
593+
}
594+
587595
validateGeometry();
588596
}
589597
}

0 commit comments

Comments
 (0)
Please sign in to comment.