<br><br><div class="gmail_quote">2010/11/9 Barry Rowlingson <span dir="ltr">&lt;<a href="mailto:b.rowlingson@lancaster.ac.uk">b.rowlingson@lancaster.ac.uk</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">
<br>
</div> That&#39;s an interesting approach! My selectplus plugin has a &#39;select<br>
all&#39; function which does this:<br></blockquote><div><br>I love coding : there is never one way to achieve things :)<br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<br>
    def doit(self):<br>
        layer = self.iface.mapCanvas().currentLayer()<br>
        layer.setSelectedFeatures(layerIds(layer))<br>
        return None<br>
<br>
where layerIds is:<br>
<br>
def layerIds(layer):<br>
    ids = []<br>
    p = layer.dataProvider()<br>
    allAttrs = p.attributeIndexes()<br>
    p.select(allAttrs)<br>
    f = QgsFeature()<br>
    while p.nextFeature(f):<br>
        ids.append(<a href="http://f.id" target="_blank">f.id</a>())<br>
    return ids<br>
<br>
Your rectangle overlay should be pretty quick, but maybe my collecting<br>
all the feature IDs is quicker?<br></blockquote><div><br>I don&#39;t know :) I tried to have a compact code, so I reused the api method that seemed simplier, in a spatial approach.<br> <br></div></div>