[Qgis-developer] Possible bug with QgsRubberBand refreshing

Anatoliy Golubev darth.naihil at gmail.com
Tue Mar 17 07:50:03 PDT 2015


Hi list!

QgsRubberBand items sometimes not refreshing properly when another map
canvas item (QgsVertexMarker) intersects them. This happens with 2.8,
in 2.6.1 works as expected.

See: https://www.dropbox.com/s/4egl61juue9ewop/rubberband.png?dl=0 as
illustration

How to reproduce:
1. Open empty project (epsg:4326)

2. Execute this script in python console:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.gui import *
from qgis.core import *

mCursor = QgsVertexMarker(iface.mapCanvas())
mCursor.setIconType(QgsVertexMarker.ICON_BOX)
mCursor.setIconSize(20)
mCursor.setZValue(5)

points = [[QgsPoint(0, 0), QgsPoint(20, 30), QgsPoint(0, 60)]]

rb = QgsRubberBand(iface.mapCanvas(), True)
rb.setToGeometry(QgsGeometry.fromPolygon(points), None)
rb.setColor(QColor(125, 125, 0))
rb.show()

def changeCursorPos(p):
    mCursor.setCenter(p)

iface.mapCanvas().xyCoordinates.connect(changeCursorPos)

3. Move mouse cursor over rubber band.
You can erase rubber band from bottom to some upper point.

Tested on win7 32bit

Anyone confirms?


More information about the Qgis-developer mailing list