Bug report #20593
Action Toggle Editing called from QPushButton starts looping
Status: | Open | ||
---|---|---|---|
Priority: | High | ||
Assignee: | - | ||
Category: | Editing | ||
Affected QGIS version: | 3.4.1 | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | Yes | Copied to github as #: | 28413 |
Description
When qgis.utils.iface.actionToggleEditing().trigger() is called from a QPushButton on a form to enable/disable editing it causes to loop.
1. Press QPushButton. First time it enables or disables the Editing Mode of that layer.
2. Press again, it runs it twice (as if it was pressed twice), so you get to the same point.
3. Press again, it runs 4 times. Again, 8 times, etc.
We discovered it actually does the same thing with startEditing(). It keeps looping exponentially every time you press it (checked with printing statements). You can also see it's enable/disabling on the QGIS interface!
On 3.2 it worked fine, so we think this is a glitch from this version.
History
#1 Updated by Nyall Dawson almost 6 years ago
- Status changed from Open to Feedback
Can you share the rest of your code? You must be creating multiple connections to an editing event somewhere.
#2 Updated by Raul Sangonzalo almost 6 years ago
Nyall Dawson wrote:
Can you share the rest of your code? You must be creating multiple connections to an editing event somewhere.
from PyQt5.QtWidgets import *
def formOpen(dialog,layerid,featureid):
global myDialog
myDialog = dialog
global inlayer
inlayer = layerid
global StartEditing
StartEditing = dialog.findChild(QPushButton, "pushEdit")
def StartEditing_clicked():
qgis.utils.iface.actionToggleEditing().trigger()
#3 Updated by Giovanni Manghi almost 6 years ago
- Status changed from Feedback to Open