<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Luca,<br>
<br>
The best way to do this, is to set your personnally designed UI file
in the layer properties->field properties->attribute editor
layout->provide ui file<br>
<br>
Then, you want to call qgis method to show a feature form: <br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a
href="http://qgis.org/api/classQgisInterface.html#aff2467aa3cefd8fc5b59213f385b7180">http://qgis.org/api/classQgisInterface.html#aff2467aa3cefd8fc5b59213f385b7180</a><br>
<br>
And you would need some processing to show it:<br>
1. get feature id from the selected line<br>
2. fetch the feature of the main layer<br>
3. get the foreign key from one of its fields<br>
4. fetch the corresponding feature<br>
4. show the feature form with it<br>
<br>
<br>
Anyway, if I understand properly, you're trying to do something
which has been recently added to QGIS (it's in the master version),
it's 1:n relations.<br>
See here for more info:<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a href="http://blog.vitu.ch/10112013-1201/qgis-relations">http://blog.vitu.ch/10112013-1201/qgis-relations</a><br>
<br>
Cheers,<br>
<br>
Denis<br>
<br>
<div class="moz-cite-prefix">On 14. 01. 14 16:50, Luca Lanteri
wrote:<br>
</div>
<blockquote
cite="mid:CAM_TN3--jyC7_asjkd7=ojLgtV1aLZQq6YaoWcJfLcQZZkU8sw@mail.gmail.com"
type="cite">
<div dir="ltr">Hi to all,
<div><br>
</div>
<div>I need a help from a python guru. I'm trying to move my
first steps with pyqgis.</div>
<div><br>
</div>
<div>I've got two qgis layer with a 1 to many relation. I create
a custom form for the parent layer with a QTableWidget that
contain the primary key of the child layer. Now I want to open
another custom form with the data of the child record selected
into the QTableWidget. I try to look up into the QGIS API
Documentation but I'didn't find the solution to my problem.</div>
<div><br>
</div>
<div>Now I just can open form with this code, connected with a
button:</div>
<div><br>
</div>
<div>
<div> path = os.path.dirname( os.path.abspath( __file__ ) )</div>
<div> uifile = os.path.join(path , my_form.ui')<br>
</div>
<div> window = uic.loadUi(uifile)</div>
<div> window.exec_()</div>
</div>
<div><br>
</div>
<div>how can I connect my form with the right data ?</div>
<div>Can I use some method to select the right layer/record and
open it in the form ?</div>
<div><br>
</div>
<div>Thanks in advance for any tips</div>
<div><br>
</div>
<div>Luca</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Qgis-developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a></pre>
</blockquote>
<br>
</body>
</html>