Bug report #10862
QGIS 2.4 adds 2 objects in one click while using Python Init functions and own UI form..
|Affected QGIS version:
|Pull Request or Patch supplied:
|Crashes QGIS or corrupts data:
|Copied to github as #:
I have a problem in QGIS 2.4 and Python Init functions working with UI form. In previus versions of QGIS everything is working fine but in 2.4 every time I add one object, QGIS adds second one in the same place. It happens if I work on SHP files or on PostgreSQL database. Second object has the same attributes as the first one (instead of GID in PostgreSQL).
I don't know if something has change in QGIS 2.4 and Python Init function. I've attached some project (works in Windows) with 2 layers (point and line), form.ui and Python script (does nothing, apart of making problem) which is part of my biger project.
Please let me know if I should change something in Python code or there is a problem in QGIS 2.4?
Only add feature once when python init function is set on attribute form
#2 Updated by Thomas Kreuzer over 9 years ago
I have the exact same problem for PostGIS layers, on Windows and on Linux.
And the problem is only because of the "Python Init Function", whether you use a custom ui or not doesn't matter.
And it doesn't matter how the "Python Init Function" looks like, even if it is just
def openForm(dialog, layer, feature): pass
QGIS will create two exact features.
This renders most database interfaces useless.
#4 Updated by Giovanni Manghi over 9 years ago
- Status changed from Open to Feedback
Seb Radzimski wrote:
OK now I know it is not only my problem. Is there any chance to fix it in 2.4 or maybe 2.6 QGIS? For now I can try to delete this duplicate object on database level...
did it worked as expected in previous qgis releases?
#7 Updated by Seb Radzimski over 9 years ago
It happens in QGIS 2.4 installed on Windows 32 and 64 bit (OSGeo4W on 7x64 and standalone installer on server 2008x86 nad XP) while working with postgis database or shp files. In previus version of QGIS (2.0 and 2.2) the same project works fine (no duplicates are added). You can check it with files attached in first post.