[Qgis-user] Using python on qgis Forms

Raymond Nijssen r.nijssen at terglobo.nl
Wed Apr 3 04:22:20 PDT 2019


Hi Kyle!

The python code to get all the id's looks like this:

ids = []
for feat in iface.activeLayer().getFeatures():
     ids.append(feat.id())
print(ids)


Now you need to connect your button to a function containing the above 
code, something like:

pushButtonShowIds.clicked.connect(getAllIds)



Please have a look at the python cookbook for code snippets:

https://docs.qgis.org/2.18/en/docs/pyqgis_developer_cookbook/index.html


Good luck!
Raymond



On 02-04-19 19:14, Kyle Felipe Vieira Roberto wrote:
> Hi!
> im from Brazil!
> I made a form, using QT4 (here we r using qgis 2.18 yet), on this form, 
> i put a button that must take all "id" from selected features in a 
> selected Layer.
> How to do it???
> 
> _*Kyle Felipe*_
> Vida longa e próspera!
> May the forçe be with you...
> #ThinkFree
> www.kylefelipe.com <http://www.kylefelipe.com>
> www.flickr.com/kylefelipe <http://www.flickr.com/kylefelipe>
> https://gitlab.com/kylefelipe
> https://github.com/kylefelipe
> 
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
> 


More information about the Qgis-user mailing list