[Qgis-developer] Open a form of a linked table
Nathan Woodrow
madmanwoo at gmail.com
Tue Jun 4 23:39:08 PDT 2013
Hey Andreas,
Just to add to Denis's code example. You can also use:
d = iface.getFeatureForm(layer,feature)
...some other code..
d.exec_()
which means you can get the dialog without opening it and open it later.
- Nathan
On Wed, Jun 5, 2013 at 1:06 AM, Andreas Neumann <a.neumann at carto.net> wrote:
> Hi Denis,
>
> Thanks - this should help me to implement it.
>
> Andreas
>
> Am 04.06.2013 16:57, schrieb Denis Rouzaud:
> > Hi ,
> >
> > I did not test, but adding a python action to the layer B should work:
> >
> > layerA = QgsMapLayerRegistry.instance().mapLayer("layerAid")
> >
> > featureAid = [% "layerAid_column_name" %]
> >
> > f = QgsFeature()
> >
> >
> layerA.getFeatures(QgsFeatureRequest().setFilterFid(featureAid)).nextFeature(f)
> >
> >
> > iface.openFeatureForm(layerA, f)
> >
> >
> > If the layerA has no geometry, you might need to add NoGeometry as a
> > flag to the feature request.
> >
> > Also, you might need to test if f is found.
> >
> > Cheers,
> >
> > Denis
> >
> >
> >
> > On 06/04/2013 04:44 PM, Andreas Neumann wrote:
> >> Hi,
> >>
> >> I have two tables with a 1:n to relation from table A to B.
> >>
> >> In the form of table "B" I want to display a button that opens the
> >> corresponding record in a form of table A (in a separate window).
> >>
> >> I know that Matthias Kuhn is working on such functionality for QGIS 2.1
> >> - but I would need a script-based solution now - this project cannot
> >> wait for QGIS 2.1
> >>
> >> Does someone have a python script that does something like that or
> >> similar things?
> >>
> >> The idea is to have a Python action with a few lines of code that does
> >> this and can be associated to a button.
> >>
> >> Thanks,
> >> Andreas
> >> _______________________________________________
> >> Qgis-developer mailing list
> >> Qgis-developer at lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/qgis-developer
> >
> >
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130605/041afe98/attachment.html>
More information about the Qgis-developer
mailing list