-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PR: Remove lambdas in Qt slots #19471
Conversation
a0b5cbe
to
54b78da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @impact27 for your help with this!
@@ -1053,6 +1053,7 @@ def update_margins(self, margin): | |||
""" | |||
self.get_widget().update_margins(margin) | |||
|
|||
@Slot() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this (see below).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't this this one should be removed, isn't it called from a signal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for example in the ipythonconsole plugin on_initialize
@@ -113,7 +113,7 @@ def on_initialize(self): | |||
self.create_action( | |||
BreakpointsActions.ListBreakpoints, | |||
_("List breakpoints"), | |||
triggered=lambda: self.switch_to_plugin(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of calling this directly, please emit sig_switch_to_plugin_requested
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't work because sig_switch_to_plugin_requested
is connected to MainWindow.switch_to_plugin
not to SpyderDockablePlugin.switch_to_plugin
Also, please rebase or merge with 5.x to get the fix to our Mac app on PR #19485. |
54b78da
to
619c58e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now, thanks @impact27!
Description of Changes
Remove unnecessary lambdas from signals
A lambda prevents qt from keeping a reference to the object, leading to:
Issue(s) Resolved
Fixes #19393
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct: