Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selectionChanged signal emitted on Mac without arguments #21767

Closed
qgib opened this issue Nov 2, 2015 · 9 comments
Closed

selectionChanged signal emitted on Mac without arguments #21767

qgib opened this issue Nov 2, 2015 · 9 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Plugins

Comments

@qgib
Copy link
Contributor

qgib commented Nov 2, 2015

Author Name: Jeff Cavner (Jeff Cavner)
Original Redmine Issue: 13740
Affected QGIS version: 2.12.0
Redmine category:python_plugins


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)

@qgib
Copy link
Contributor Author

qgib commented Nov 6, 2015

Author Name: Giovanni Manghi (@gioman)


  • priority_id was changed from Severe/Regression to Normal
  • fixed_version_id removed Version 2.12

@qgib
Copy link
Contributor Author

qgib commented Nov 6, 2015

Author Name: Jürgen Fischer (@jef-n)


  • subject was changed from selectionChanged signal emited on Mac without arguments to selectionChanged signal emitted on Mac without arguments

@qgib
Copy link
Contributor Author

qgib commented Nov 20, 2015

Author Name: Sebastian Dietrich (Sebastian Dietrich)


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.

@qgib
Copy link
Contributor Author

qgib commented Nov 20, 2015

Author Name: Nyall Dawson (@nyalldawson)


Can you test with master? This should already be fixed

@qgib
Copy link
Contributor Author

qgib commented Dec 1, 2015

Author Name: Jeff Lifemapper Project (Jeff Lifemapper Project)


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

@qgib
Copy link
Contributor Author

qgib commented Dec 1, 2015

Author Name: Nyall Dawson (@nyalldawson)


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


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Dec 1, 2015

Author Name: Jürgen Fischer (@jef-n)


fixed in b5794b2

@qgib
Copy link
Contributor Author

qgib commented Dec 1, 2015

Author Name: Jeff Lifemapper Project (Jeff Lifemapper Project)


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

@qgib
Copy link
Contributor Author

qgib commented Dec 2, 2015

Author Name: Jürgen Fischer (@jef-n)


Fixed in changeset "5f86422942f73dc6e52c42945c4760fe0674d8c5".


  • status_id was changed from Feedback to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Plugins labels May 25, 2019
@qgib qgib closed this as completed May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Plugins
Projects
None yet
Development

No branches or pull requests

1 participant