@@ -436,7 +436,10 @@ void QgsVertexTool::cadCanvasPressEvent( QgsMapMouseEvent *e )
436
436
}
437
437
438
438
if ( !clickedOnHighlightedVertex && e->button () == Qt::LeftButton )
439
+ {
439
440
setHighlightedVertices ( QList<Vertex>() ); // reset selection
441
+ updateLockedFeatureVertices ();
442
+ }
440
443
}
441
444
442
445
if ( e->button () == Qt::LeftButton )
@@ -994,11 +997,7 @@ void QgsVertexTool::tryToSelectFeature( QgsMapMouseEvent *e )
994
997
// there's really nothing under the cursor or while cycling through the list of available features
995
998
// we got to the end of the list - let's deselect any feature we may have had selected
996
999
setHighlightedVertices ( QList<Vertex>(), ModeReset );
997
- mLockedFeature .reset ();
998
- if ( mVertexEditor )
999
- {
1000
- mVertexEditor ->updateEditor ( nullptr );
1001
- }
1000
+ cleanupLockedFeature ();
1002
1001
}
1003
1002
1004
1003
// we have either locked ourselves to a feature or unlocked again
@@ -1328,11 +1327,7 @@ void QgsVertexTool::updateVertexEditor( QgsVectorLayer *layer, QgsFeatureId fid
1328
1327
if ( mLockedFeature && mLockedFeature ->featureId () == fid && mLockedFeature ->layer () == layer )
1329
1328
{
1330
1329
// if show feature is called on a feature that's already binded to the vertex editor, toggle it off
1331
- mLockedFeature .reset ();
1332
- if ( mVertexEditor )
1333
- {
1334
- mVertexEditor ->updateEditor ( nullptr );
1335
- }
1330
+ cleanupLockedFeature ();
1336
1331
return ;
1337
1332
}
1338
1333
@@ -1345,16 +1340,42 @@ void QgsVertexTool::updateVertexEditor( QgsVectorLayer *layer, QgsFeatureId fid
1345
1340
mLockedFeature ->selectVertex ( mSelectedVertices .at ( i ).vertexId );
1346
1341
}
1347
1342
}
1348
-
1349
1343
connect ( mLockedFeature .get (), &QgsLockedFeature::selectionChanged, this , &QgsVertexTool::lockedFeatureSelectionChanged );
1350
1344
}
1351
1345
1346
+ updateLockedFeatureVertices ();
1347
+
1352
1348
// make sure the vertex editor is alive and visible
1353
1349
showVertexEditor (); // #spellok
1354
1350
1355
1351
mVertexEditor ->updateEditor ( mLockedFeature .get () );
1356
1352
}
1357
1353
1354
+ void QgsVertexTool::updateLockedFeatureVertices ()
1355
+ {
1356
+ qDeleteAll ( mLockedFeatureVerticesMarkers );
1357
+ mLockedFeatureVerticesMarkers .clear ();
1358
+ if ( mVertexEditor && mLockedFeature )
1359
+ {
1360
+ const QList<QgsVertexEntry *> &vertexMap = mLockedFeature ->vertexMap ();
1361
+ for ( const QgsVertexEntry *vertex : vertexMap )
1362
+ {
1363
+ if ( !vertex->isSelected () )
1364
+ {
1365
+ QgsVertexMarker *marker = new QgsVertexMarker ( canvas () );
1366
+ marker->setIconType ( QgsVertexMarker::ICON_CIRCLE );
1367
+ marker->setIconSize ( QgsGuiUtils::scaleIconSize ( 10 ) );
1368
+ marker->setPenWidth ( QgsGuiUtils::scaleIconSize ( 3 ) );
1369
+ marker->setColor ( Qt::red );
1370
+ marker->setFillColor ( Qt::red );
1371
+ marker->setCenter ( toMapCoordinates ( mLockedFeature ->layer (), vertex->point () ) );
1372
+ mLockedFeatureVerticesMarkers .append ( marker );
1373
+ }
1374
+ }
1375
+ }
1376
+ }
1377
+
1378
+
1358
1379
void QgsVertexTool::showVertexEditor () // #spellok
1359
1380
{
1360
1381
if ( !mVertexEditor )
@@ -1382,6 +1403,16 @@ void QgsVertexTool::cleanupVertexEditor()
1382
1403
mVertexEditor .reset ();
1383
1404
}
1384
1405
1406
+ void QgsVertexTool::cleanupLockedFeature ()
1407
+ {
1408
+ mLockedFeature .reset ();
1409
+ if ( mVertexEditor )
1410
+ {
1411
+ mVertexEditor ->updateEditor ( nullptr );
1412
+ }
1413
+ updateLockedFeatureVertices ();
1414
+ }
1415
+
1385
1416
void QgsVertexTool::lockedFeatureSelectionChanged ()
1386
1417
{
1387
1418
Q_ASSERT ( mLockedFeature );
@@ -1396,6 +1427,8 @@ void QgsVertexTool::lockedFeatureSelectionChanged()
1396
1427
}
1397
1428
1398
1429
setHighlightedVertices ( vertices, ModeReset );
1430
+
1431
+ updateLockedFeatureVertices ();
1399
1432
}
1400
1433
1401
1434
static int _firstSelectedVertex ( QgsLockedFeature &selectedFeature )
0 commit comments