COMP: Fix ambiguous QString::arg() overload for char arguments in Qt5#1375
Merged
jamesobutler merged 1 commit intocommontk:masterfrom Mar 28, 2026
Merged
Conversation
Contributor
Author
|
@jcfr A small change for better Qt6 support. |
3 tasks
Wrap char ternary expressions with QChar() to disambiguate between QString::arg(QChar) and QString::arg(int) overloads that are ambiguous in Qt5 when passed plain char values. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d6194b0 to
7d2d6af
Compare
jamesobutler
approved these changes
Mar 28, 2026
Contributor
Author
|
@jamesobutler Thank you. FYI: I do not have the privileges to merge or add reviewers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picked from #1372, part of a systematic clazy static analysis effort to improve CTK for Slicer compatibility and Qt6 migration.
What this changes
Wraps
charliteral arguments toQString::arg()inQChar()to resolve the ambiguous overload introduced in Qt5. Without this fix, the compiler selects the wrong overload, which can produce incorrect output and triggers a compiler warning.Affected file:
Libs/Widgets/ctkFontButton.cppWhy
Compiler warning and potential wrong-overload selection in Qt5+.
QString::arg(char)is ambiguous betweenarg(QChar)andarg(int)— wrapping inQChar()makes the intent unambiguous.Testing
🤖 Identified via clazy static analysis using CTK-claude-skills