hello i have create a layer filter Expression to get specific results query
from my layer and i add this results in list widget using pyqt.

my Expression and my add to list widget work fine(i take correct ids numbers
in the print and i see that ids in list widget).

but if i want to zoom feature using double click signal in list widget then
i take zoom
in the wrong features(features where my Expression is False).Any idea where
i have wrong in my code and to take wrong features zoom?


my code :

__init__
self.connect(self.ui.listWidget, SIGNAL("itemDoubleClicked (QListWidgetItem
*)"), self.Zoomt)


my filter :
             def myfilter(self):
                layer = 
QgsMapLayerRegistry.instance().mapLayersByName("mylayrt")[0]
                request = QgsFeatureRequest().setFilterExpression('"name" =
\'{0}\''.format(myname))
                         for feature in layer.getFeatures(request):
                                print str(feature.attribute("myid"))
                                
self.ui.listWidget.addItem(str(feature.attribute("myid")))


result print :

1
42
43
44
45
96
111
304
458
508
579
602
606
646


that is ids add correct in list widget (14 ids).


zoom button .

        def Zoomt(self):
                Vl_Gs = 
QgsMapLayerRegistry.instance().mapLayersByName("mylayer")[0]
                Vl_Gs.removeSelection
                Vl_Gs.setSelectedFeatures([self.ui.listWidget.currentRow()])
                self.mapCanvas.zoomToSelected(Vl_Gs)

zoom ids (take first 14 from my layer)  :

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14

is len number is correct but the ids zoom is wrong,why?



--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to