4

I have several plugins I am using that involve rubberbands and their equivalent points (QgisVertexMarkers). My problem looks to come from removing them from the display. This process worked fine in QGIS 3.8, But now QGIS crashes with version 3.10.

The code I'm using is shown here.

    vertex_items = [ i for i in self.iface.mapCanvas().scene().items() if issubclass(type(i), QgsVertexMarker)]
    for ver in vertex_items:
        if ver.data(1)=="COGOStartPoint":
            self.iface.mapCanvas().scene().removeItem(ver)

    m = QgsVertexMarker(self.iface.mapCanvas())
    red = QColor(255, 0, 0,255)
    m.setIconType(4)  #1=cross,  2=x,  3=box,  4=circle
    m.setIconSize(8)
    m.setPenWidth(2)
    m.setCenter(QgsPointXY(pt))
    m.setColor(red)
    m.setData(1,"COGOStartPoint")
    m.show()

It seems to be the first few lines of code that causes the freeze. Trying to remove the points no longer works, drawing the points is still fine. I found this technique from PyGIS remove QgisVertexMarker from scene .

What has changed in version 3.10 from 3.8 that would cause this behavior?

Is this still the best way (the only way) to remove rubberband type graphics?

1 Answer 1

1

Apparently, this was a bug, but has been corrected and will be in the next release. 3.10.1 (available November 25) should have it fixed. Thanks for all the work!

Update (July, 2020): This method of removing RubberBand graphics works for VertexMarkers, but NOT for RubberBand Lines. It appears that the setData() applies to points but not lines. I can find no information on the use of setData(), or on best methods for temporary screen graphics.

More answers needed...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.