Skip to content

Conversation

adriazalvarez
Copy link
Contributor

@adriazalvarez adriazalvarez commented Oct 1, 2024

Description of work

Changes the signals and slots of the Inelastic interfaces from string-based to functor-based connections (getting rid of SIGNAL/SLOT macros).
One of the main advantages is that the connections are checked at compile-time, so we avoid the problem of missing connections in qt interfaces at runtime.
Additionally, syntax is probably more straightforward, as it explicitly states the object that sends/receives the signal.
On the flip side, the syntax for overloaded signals/slots (which there are a few) is a little bit more involved, as the function has to be cast with a pointer to member function. (qoverloaded classes could have been used here, but it is not available for qt 5.15)
Details here: https://wiki.qt.io/New_Signal_Slot_Syntax
Also, if the slots are expected to be called with a default argument, a lambda function shall be used.

This is first part of #37904 , indirect interface and spectroscopy widget libraries are also going to be updated soon.

Summary of work

Fixes #37904 (partially).

Further detail of work

To test:

Testing is straightforward, although probably tedious. I have tested it on MacOS and every GUI seems to be responding as expected.

Does not required release notes as it is an internal change


Reviewer

Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Do the release notes conform to the release notes guide?

Functional Tests

  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

@adriazalvarez adriazalvarez added Indirect/Inelastic Issues and pull requests related to indirect or inelastic GUI Issues and pull requests specific to the Mantid Workbench GUI. Maintenance Unassigned issues to be addressed in the next maintenance period. labels Oct 1, 2024
@adriazalvarez adriazalvarez added this to the Release 6.12 milestone Oct 1, 2024
… it is changed to QComboBox::currentIndexChanged(int) in the affected instances
Copy link
Contributor

@MohamedAlmaki MohamedAlmaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested all the interfaces, and they are working as expected. But there is some problem with Bayes and Stretch tabs. When I try to run them, they get stuck in the running state. This is not related to this PR because the issue happens in the nightly, too. Please check if you can replicate this issue on your side

@adriazalvarez
Copy link
Contributor Author

Thanks for testing.
I haven't had any problem with bayes fitting interface for this pr or the nightly. What files or run numbers are you using?

@MohamedAlmaki
Copy link
Contributor

I am using the same ones as in the test instructions. I think the issue might be occurring on my laptop because I am experiencing memory issues. I will attempt to take another look to see if there is a problem, but I am happy to approve now as this is not related to this pull request.

MohamedAlmaki
MohamedAlmaki previously approved these changes Oct 11, 2024
Copy link
Contributor

@MohamedAlmaki MohamedAlmaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the changes which improve the maintainability of signals and slots in the interfaces

@robertapplin robertapplin self-assigned this Oct 11, 2024
Copy link
Contributor

@robertapplin robertapplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All comments addressed. This was previously approved by Mohammed, so it can be merged now

@robertapplin robertapplin merged commit c0a62ab into main Oct 14, 2024
10 checks passed
@robertapplin robertapplin deleted the new_qt_connection_syntax_inelastic_interfaces branch October 14, 2024 14:35
mpatrou pushed a commit that referenced this pull request Nov 22, 2024
This is a squashed version of #38119

new signal/slot syntax changed on QENSFitting

update signals/slots in processor and corrections interfaces

new signal/slots on bayes fitting interface

QComboBox::currentIndexChanged(QString &) was found to be deprecated, it is changed to QComboBox::currentIndexChanged(int) in the affected instances

remove accidental includes
mpatrou added a commit that referenced this pull request Nov 25, 2024
Add tests for IqtPresenter tab #37901
Elwin allow processing ILL data #38033
Update Qt connection syntax in Inelastic Interfaces #38119
Update Moments tab instructions and add more tests #38274
Construct the model of OutputPlotOptions widget outside the Presenter class.  #38289
Add identifier for output workspaces in Elwin Interface #37762
MVP for the ResNorm tab of the Inelastic Bayes Fitting interface #38357
Remove deprecated Calculate Paalman Pings tab from Inelastic Corrections #38391
Use std::pair instead of QPair in utility files #38396
Elwin Elastic line integration issue #38392
---------

Co-authored-by: adriazalvarez <adrian.diaz-alvarez@stfc.ac.uk>
Co-authored-by: Applin <robert.applin@stfc.ac.uk>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GUI Issues and pull requests specific to the Mantid Workbench GUI. Indirect/Inelastic Issues and pull requests related to indirect or inelastic Maintenance Unassigned issues to be addressed in the next maintenance period.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use new signal/slot syntax in Indirect/Inelastic interfaces

3 participants