wip: gui: Drop connectSlotsByName usage#18246
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
uictool 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
connectSlotsByNameusage 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-autoconnectionor-a, but this will take longer since it's only available in recent Qt.For reference:
Review with
QT_FATAL_WARNINGS=1.