Bug report #20593
Action Toggle Editing called from QPushButton starts looping
|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|
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.
#2 Updated by Raul Sangonzalo over 2 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 *
myDialog = dialog
inlayer = layerid
StartEditing = dialog.findChild(QPushButton, "pushEdit")