[Qgis-developer] Map canvas zoom resets visibility of QgsRubberBand

Sandro Santilli strk at keybit.net
Thu Apr 2 02:20:00 PDT 2015


On Thu, Apr 02, 2015 at 09:24:42AM +0300, Anatoliy Golubev wrote:
> Hi devs!
> 
> I found another issue with QgsRubberBand which appear after fixing
> #12392. See #12486 for details.
> 
> Im trying to fix this issue and have a questions about expected
> behavior of QgsRubberBand.
> When we create QgsRubberBand:
>     QgsRubberBand *rb = new QgsRubberBand(mCanvas, 0);
> constructor calls reset() and as a result visibility sets to false.
> 
> When we add valid geometry (not empty) calling addGeometry(geom,
> layer) to empty rb - visibility should be set to true.
> 
> When we add point to empty rb without updating ( rb->addPoint(point,
> false) ) visibility should not change and stay false.
> 
> When we add point to empty rb with updating ( rb->addPoint(point,
> true) ) visibility should be set to true.
> 
> Is this correct behavior or we must manually call setVisible( true )
> to show rubberband on map?

My personal preference (for ease and intuitiveness) would be:

 - On construction - visibility=true (follows QWidget policy?)
 - Adding geometries - no visibility change

What I'm unable to evaluate is how much would changing behavior
affect existing user code.

--strk; 


More information about the Qgis-developer mailing list