[Qgis-developer] Expression based labeling

Martin Dobias wonder.sk at gmail.com
Thu Oct 27 08:46:11 EDT 2011


On Thu, Oct 27, 2011 at 5:28 AM, Nathan Woodrow <madmanwoo at gmail.com> wrote:
> Thanks Andreas. Glad you like it.
>>> Question 1: the output preview of the label does not seem to work when I
>>> use a field - is there something I need to >>do to enable it? I would expect
>>> it to pull in the first record or some random record to retrieve values?
>
> Ah yes there seems to be a bug with grabbing the first record with some data
> sources.  I get the top feature using layer.featureAt(0) but for some reason
> not all providers return a record at this index.  Writing a patch now.

That is because not all data providers use ids in interval [0,N-1].
For example, postgres provider uses the column with primary key as ID
- so the values may be arbitrary. It is better to do a select()
followed by just one nextFeature().

Martin


More information about the Qgis-developer mailing list