2

Im developing QGIS plugin (Python3)

to open the featureForm (depending on some of my conditions (matching geometries,...))I use this code:

            layer = self.iface.activeLayer()
            features = layer.getFeatures()

            for feat in features:
                geom_poly = feat.geometry()
                if self.feature.geometry().intersects(geom_poly):
                    layer.selectByIds([feat.id()])
                    f = feat
            self.iface.openFeatureForm(layer, f, True)

the code works correctly, what I want is to set the position of the featureForm

how can I "catch" featureForm and use something like QDialog.move(x, y)

2

I found the solution, I used:

virtual QgsAttributeDialog* QgisInterface::getFeatureForm ( QgsVectorLayer * l, QgsFeature & f )

Returns a feature form for a given feature.

Parameters:

l :The layer for which the dialog will be created

f :The feature for which the dialog will be created

Here is a code if someone else needs it:

   form = self.iface.getFeatureForm(layer, f) # QgsAttributeDialog
   form.move(0,0)
   form.show()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.