<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>I found this thread very helpful. It seems to be that to the dialog into edit mode this has to be done programmatically by calling startEditing() - not by simply having the layer in edit mode. Can anyone else verify that? Regardless, thanks for the pointers and suggestions in the thread. Much appreciated.</div><div><br></div>On 30/09/2014, at 8:12 pm, Alexandre Neto <<a href="mailto:senhor.neto@gmail.com">senhor.neto@gmail.com</a>> wrote:<br><div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi<br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 30, 2014 at 6:42 AM, Denis Rouzaud <span dir="ltr"><<a href="mailto:denis.rouzaud@gmail.com" target="_blank">denis.rouzaud@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"><br>
<br>
<div>If you want to open a feature form like
doing it from QGIS, just run:<br>
<br>
iface.openFeatureForm(layer, feature, false, true/false) <br>
<br>
<a href="http://qgis.org/api/classQgisInterface.html#a11b90f38afd09ac5e9f363933ee4a509" target="_blank">http://qgis.org/api/classQgisInterface.html#a11b90f38afd09ac5e9f363933ee4a509</a><br>
<br>
Cheers,<br>
<br>
Denis<div><div class="h5"><br></div></div></div></div></blockquote><div><br></div><div>Actually this how my plugin worked back in QGIS 2.2. But in the latest versions the iface.openFeatureForm() is always in add mode (like <a class="" href="http://qgis.org/api/classQgsAttributeDialog.html#a2fbbff1c23be058caa26cc5aaf7040e8" style="color:rgb(70,101,162);font-weight:bold;font-family:Roboto,sans-serif;font-size:14px;line-height:22px">setIsAddDialog</a>). That is, after accepting the dialog, it adds a new feature, and does not update my temporary feature. This leaves no room for any changes before the feature commit. I described my problem in the following bug report, and Matthias Kuhn adviced me to create my own Dialog, so that's what I'm trying to do. I would be glad to use iface.openFeatureForm() only</div><div><br></div><div><a href="https://hub.qgis.org/issues/11099">https://hub.qgis.org/issues/11099</a><br></div><div><br></div><div>Thanks for your help</div><div><br></div><div>Alexandre</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><div><div class="h5">
<br>
<br>
On 29.09.2014 18:19, Alexandre Neto wrote:<br>
</div></div>
<blockquote type="cite"><div><div class="h5">
<div dir="ltr">Hello Salvatore,
<div><br>
</div>
<div>You were right, I just needed to import the class first,
this have opened the form for me:</div>
<div><br>
</div>
<div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">from
qgis.gui import QgsAttributeDialog<br>
mc = iface.mapCanvas()<br>
layer = mc.currentLayer()<br>
temp_feature.setAttributes(attributes)<br>
dialog = QgsAttributeDialog(layer, temp_feature, True)<br>
dialog.show()</blockquote>
</div>
<div><br>
</div>
<div>But now I can't make it editable.</div>
<div><br>
</div>
<div>All I can do is cancel the dialog.</div>
<div><br>
</div>
<div>Thanks for your help,</div>
<div><br>
</div>
<div>Alexandre Neto</div>
<div><br>
</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Sep 29, 2014 at 4:21 PM,
Salvatore Larosa <span dir="ltr"><<a href="mailto:lrssvtml@gmail.com" target="_blank">lrssvtml@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi,<br>
<span><br>
On Mon, Sep 29, 2014 at 4:56 PM, Alexandre Neto <<a href="mailto:senhor.neto@gmail.com" target="_blank">senhor.neto@gmail.com</a>>
wrote:<br>
> Hello,<br>
><br>
> I'm trying to open an attribute dialog for a
temporary feature using<br>
> QgsAttributeDialog(). but with no luck. Can anyone
point me to working<br>
> example?<br>
> I'm trying something like this:<br>
><br>
>><br>
>> mc = iface.mapCanvas()<br>
>> layer = mc.currentLayer()<br>
>> dialog = QgsAttributeDialog(layer, temp_feature)<br>
>> dialog.show()<br>
<br>
</span>I think you should to import the class before and
setting the feature<br>
owner bool parameter.<br>
after this changes the snippet should work fine for you!<br>
<br>
Regards,<br>
-SL<br>
<span><font color="#888888"><br>
--<br>
Salvatore Larosa<br>
linkedIn: <a href="http://linkedin.com/in/larosasalvatore" target="_blank">http://linkedin.com/in/larosasalvatore</a><br>
twitter: @lrssvt<br>
skype: s.larosa<br>
IRC: lrssvt on freenode<br>
</font></span></blockquote>
</div>
<br>
</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></div>
_______________________________________________<br>Qgis-developer mailing list<br><a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>http://lists.osgeo.org/mailman/listinfo/qgis-developer</blockquote></div><br></body></html>