Skip to content

Fix ADL lookup for cvf pdmToVariant/pdmFromVariant overloads#13848

Merged
magnesj merged 2 commits intodevfrom
fix-adl-cvf-pdm-variant-lookup
Apr 8, 2026
Merged

Fix ADL lookup for cvf pdmToVariant/pdmFromVariant overloads#13848
magnesj merged 2 commits intodevfrom
fix-adl-cvf-pdm-variant-lookup

Conversation

@magnesj
Copy link
Copy Markdown
Member

@magnesj magnesj commented Apr 8, 2026

Move pdmToVariant/pdmFromVariant overloads for cvf::Color3f, Vec3d, Mat4d, and
Mat3d from namespace caf to namespace cvf. Templates in
cafInternalPdmFieldTypeSpecializations.h use "using caf::pdmToVariant" followed
by an unqualified call, so ADL searches the argument's namespace (cvf). With the
overloads only in caf, the default template was selected, causing cvf::Color3f to
be stored raw in a QVariant instead of as QColor — breaking color field editing
and producing QVariant::save warnings.

Update all explicit caf::pdmToVariant/pdmFromVariant call sites for cvf types in
application code and unit tests to use cvf:: namespace. Add AdlVariantTest to
cafPdmCoreColor3fTest.cpp that exercises the exact template pattern.

@magnesj magnesj force-pushed the fix-adl-cvf-pdm-variant-lookup branch from 7ab4968 to a21fec7 Compare April 8, 2026 16:25
Move pdmToVariant/pdmFromVariant overloads for cvf::Color3f, Vec3d, Mat4d, and
Mat3d from namespace caf to namespace cvf. Templates in
cafInternalPdmFieldTypeSpecializations.h use "using caf::pdmToVariant" followed
by an unqualified call, so ADL searches the argument's namespace (cvf). With the
overloads only in caf, the default template was selected, causing cvf::Color3f to
be stored raw in a QVariant instead of as QColor — breaking color field editing
and producing QVariant::save warnings.

All call sites now use the unqualified "using caf::pdmXxx; pdmXxx(value)" pattern
so ADL finds the correct overload without depending on cvf:: as a visible prefix.
Add AdlVariantTest to cafPdmCoreColor3fTest.cpp that exercises this exact pattern.

Fixes by clang-format
@magnesj magnesj force-pushed the fix-adl-cvf-pdm-variant-lookup branch from a21fec7 to ba6bc16 Compare April 8, 2026 16:27
@magnesj magnesj marked this pull request as ready for review April 8, 2026 16:29
Comment thread ApplicationLibCode/Commands/AnnotationCommands/RicTextAnnotation3dEditor.cpp Outdated
Adds caf::toVariant<T> and caf::fromVariant<T> to cafPdmFieldTraits.h as
thin wrappers that encapsulate the ADL two-step internally. Client code can
now call caf::toVariant(x) directly instead of requiring a using-declaration
at every call site.
@magnesj magnesj merged commit e822348 into dev Apr 8, 2026
17 checks passed
@magnesj magnesj deleted the fix-adl-cvf-pdm-variant-lookup branch April 8, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants