[Qgis-developer] Re: flickering on display through plugin

Martin Dobias wonder.sk at gmail.com
Mon Jun 26 05:10:08 EDT 2006


Hi,

do you call setVisible() (or show()) in your map canvas item? Because
canvas items are not shown by default.

Also you need to tell canvas the position and size of the item - this
can be done by setting mRect or by overriding updatePosition (where
you calculate the rectangle by yourself and call move() and setSize()
). Such rectangle is used by canvas to decide whether the item is
visible and should be drawn.

For more examples, here are all classes currently in QGIS code which
inherit from QgsMapCanvasItem.

QgsRubberBand - for drawing any kind of polyline or polygon
QgsVertexMarker - displays a simple icon on desired position
QgsGeorefDataPoint - marks a point and shows its coordinates (in
georeferencer plugin)
QgsGrassEditLayer - displays a pixmap (in grass plugin)

If you will still experience problems then post you code here, maybe
we could help you.


Martin

On 6/26/06, nitin quick <quick.nitin at gmail.com> wrote:
> hello sir
> For avoiding flickering i i reimplemented my class and inherited from
> QgsMapCanvasItem.
> i defined drawShape(QPainter &) in my code but it is never getting called
> even after multiple call to updateCanvas().
> I has studied Measure area maptool code. Where similar code is there and
> same control flow do work. Can anybody advice on this issue while such thing
> is happening?if there is need, i can post my code also.
> regards
>  quick nitin
>
>
> On 6/18/06, nitin quick < quick.nitin at gmail.com> wrote:
> >
> > thanks for replying
> > sorry i didn't mentioned qgis version. Currently i am using qgis0.7.9 from
> svn , downloaded around 1 month before and which i think is nearer to 0.8.
> > One place i got down whichi think is potential reason of flickering is i
> had connected render function of myplugin with signal emmitted by
> mQgisIface->getMapCanvas()->renderComplete(QPainter *). Why
> i connected these because i needed QPainter refrence for drawing on canvas.
> Is my reasoning  correct?
> > If so , ihave tried to save the state of passed pointer in one of global
> variable in my plugin but global painter object is not active? is it
> possible to do so. I think it should happen may be smwhere i am making some
> mistake.
> > Any tips on avoiding such kind of flickering. since i am using qgis0.8
> there is no bitblt() available.
> >
> >
> > cya
> >
>
> quick nitin
>
> On 6/16/06, Tim Sutton <tim at linfiniti.com> wrote:
> > Hi
> >
> > You could try bitblt ing your points onto the canvas? Which version
> > of qgis is your plugin written for? 0.8 will use qcanvas as a basis
> > for map canvas...
> >
> > Regards
> >
> > Tim
> > On 16/06/2006, at 00:28, nitin quick wrote:
> >
> > > hello everybody,
> > > i currently working on a plugin which will dispaly points on
> > > current canvas with points read from a fifo.Plugin implementation
> > > is done as external plugin build tutorial. Plugin is also working.
> > > but i have problem of flickering. As i understood the interface for
> > > plugin building, after reading data i am calling for refresh of
> > > canvas using mQGisIface->getMapCanvas()->refresh() .
> After this i
> > > receives a signal which is renderComplete()  which is connected to
> > > render(QPainter *). It is very similar to NorthArrow plugin
> > > functionality.reading from a fifo is done through a thread which
> > > signal to gui thread after reading data every second. i think i am
> > > refreshing to everydrawing refreshing is bound to happen. But as no
> > > of elements on canvas increases it becomes very odd and ugly . I
> > > want to avoid it. Any advices how i can improve on it a nd get rid
> > > of flickering.
> > >
> > > thanks
> > > quick nitin
> > > _______________________________________________
> > > Qgis-developer mailing list
> > > Qgis-developer at lists.qgis.org
> > >
> http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer
> >
> > Tim Sutton
> > tim at linfiniti.com
> >
> >
> >
> >
>
>
>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.qgis.org
> http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer
>
>
>



More information about the Qgis-developer mailing list