Bug report #13740
selectionChanged signal emitted on Mac without arguments
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Python plugins | ||
Affected QGIS version: | 2.12.0 | Regression?: | No |
Operating System: | OSX | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 21767 |
Description
On OSX Yosemite, 10.10.5, both QGIS version 2.10 and 2.12 (KyngChaos installer), GDAL 1.11., When selectionChanged signal for QgsVectorLayer is connected to a user defined slot and the signal is emitted it doesn't send the selected, unselected, clearAndSelect arguments. Programmaticly using select and setSelectedFeatures and manually selecting cause this behaviour. The problem does not exist for Windows 7 Professional or Ubuntu, only OSX.
So:
lyr = iface.activeLayer()
def mySlot(selected, unselected, clearAndSelect):
print "here"
lyr.selectionChanged.connect(mySlot)
Make a Selection on the canvas
TypeError: mySlot() takes exactly 3 arguments (0 given)
Associated revisions
- fix QgsFeatureIds typedef (fixes missing signal
QgsVectorLayer.featuresDeleted and others; fixes #13740) - add missing notes for PyNames
- include some missing new methods in bindings
(backported from commit b5794b2)
sip bindings: fix QgsFeatureIds typedef (fixes missing signal
QgsVectorLayer.featuresDeleted and others; fixes #13740)
(backported from commit b5794b2)
History
#1
Updated by Giovanni Manghi almost 9 years ago
- Priority changed from Severe/Regression to Normal
- Target version deleted (
Version 2.12)
#2
Updated by Jürgen Fischer almost 9 years ago
- Subject changed from selectionChanged signal emited on Mac without arguments to selectionChanged signal emitted on Mac without arguments
#3
Updated by Sebastian Dietrich over 8 years ago
Note that selectionChanged
is an overloaded signal that comes in two variants, one with 3 arguments and one without any arguments:
signals: void selectionChanged( const QgsFeatureIds selected, const QgsFeatureIds deselected, const bool clearAndSelect ); void selectionChanged();
Apparently the overload that is used by default on Windows is the first one, while on Mac the second one is used.
As a workaround try specifying the exact overload you want to connect:
lyr.selectionChanged['QgsFeatureIds', 'QgsFeatureIds', bool].connect(mySlot)
This also works on Windows.
#4
Updated by Nyall Dawson over 8 years ago
Can you test with master? This should already be fixed
#5
Updated by Jeff Lifemapper Project over 8 years ago
specifying the exact overload in mac doesn't work, for 2.12 or for 2.8.4 (returned to LTR on KyngChaos just to make sure)
lyr.selectionChanged['QgsFeatureIds', 'QgsFeatureIds', bool].connect(mySlot)
TypeError: C++ type 'QgsFeatureIds' is not supported as a signal argument type
#6
Updated by Nyall Dawson over 8 years ago
- Status changed from Open to Feedback
Hi Jeff,
Can you test with a nightly snapshot please? We want to verify if changes made a few weeks ago fixed this, but they are NOT included in 2.12/2.8.4
#7
Updated by Jürgen Fischer over 8 years ago
fixed in b5794b2f
#8
Updated by Jeff Lifemapper Project over 8 years ago
Yes, I found the nightly at http://qgis.dakotacarto.com/, and tested 2.13 dev. It seems to work, both as the default (sending the selected, deselected, clear and Select by default), and the 'QgsFeatureIds' doesn't throw an error should you have to specify the exact overload.
Thank you
#9
Updated by Jürgen Fischer over 8 years ago
- Status changed from Feedback to Closed
Fixed in changeset 5f86422942f73dc6e52c42945c4760fe0674d8c5.