-
Notifications
You must be signed in to change notification settings - Fork 37.7k
wip: gui: Drop connectSlotsByName usage #18246
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
Conversation
Seeking concept ACK - this is still incomplete. Maybe worth adding a lint script to prevent future |
7d7a05e
to
750ce5c
Compare
... and add a note to the dev docs. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Pros of the current implementation (from Qt docs):
OTOH, I'd prefer to handle ui-form-emitted signals in a distinguishable way, and to have 100% test coverage for them. So I'm ok with auto-connection for such cases. Here are some refs for the record:
Mind adding "WIP" marker? |
@hebasto thanks for reviewing. WIP added.
That sounds more work than replacing with explicit I don't agree with those Pros you reference. There's nothing guaranteeing (beside review) the UI doesn't break if a slot is renamed/changed or a UI component is renamed. For this reason it's also dangerous to touch/refactor/cleanup this code. I can change the approach to keep the slots instead of moving to connect-to-lambda though. Slots could be transformed to camel case and then a linter would prevent the |
We could test ui-emitted signals though.
Agree.
That was my first thought too. I have no strong opinion about that. It seems we should consider code readability as well. |
@hebasto also note that the new uic option |
🐙 This pull request conflicts with the target branch and needs rebase. |
Concept ACK. |
Too soon to spend time working/reviewing on this. I'll reopen once we use Qt6. Thanks for @hebasto. |
The code generated by
uic
tool addsQObject::connectSlotsByName()
, see https://doc.qt.io/qt-5/qmetaobject.html#connectSlotsByName for more information. This can be confirmed withgrep connectSlotsByName src/qt/forms/ui*
After #13529 it makes sense to also drop
connectSlotsByName
usage following the same reasoning - these connections are now in compile time checked.Also, starting from qt/qtbase@6301d5e#diff-d720bd2a996f09262e267c4917e4cc86it is possible to pass
--no-autoconnection
or-a
, but this will take longer since it's only available in recent Qt.For reference:
Review with
QT_FATAL_WARNINGS=1
.