<div dir="ltr">Hi denis, <div>thanks a lot for the tip,I'll try it immediately.</div><div><div><div><br></div><div>I know the brand new "1 to many" feature present in qgis 2.1 and it's gorgeous, but as I know it works only with autogenerate forms, but I need to use a custom forn because I have some code into it.</div>
<div><br></div></div></div><div>many thanks</div><div>Luca</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014/1/14 Denis Rouzaud <span dir="ltr"><<a href="mailto:denis.rouzaud@gmail.com" target="_blank">denis.rouzaud@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div 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>
    
    <a href="http://qgis.org/api/classQgisInterface.html#aff2467aa3cefd8fc5b59213f385b7180" target="_blank">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>
    
    <a href="http://blog.vitu.ch/10112013-1201/qgis-relations" target="_blank">http://blog.vitu.ch/10112013-1201/qgis-relations</a><br>
    <br>
    Cheers,<br>
    <br>
    Denis<div><div class="h5"><br>
    <br>
    <div>On 14. 01. 14 16:50, Luca Lanteri
      wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <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></fieldset>
      <br>
      </div></div><pre>_______________________________________________
Qgis-developer mailing list
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a></pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br></div>