mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-27 23:50:19 -05:00
Fix ADL lookup for cvf pdmToVariant/pdmFromVariant overloads
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. 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.
This commit is contained in:
1 parent
700549fb3b
commit
e8223485b1
13 files changed
+107
-38
No files matched your search
@@ -520,7 +520,7 @@ void RimWellPathGeometryDef::fieldChangedByUi( const caf::PdmFieldHandle* change
|
||||
linkedDefs.end() );
|
||||
|
||||
cvf::Vec3d oldPos;
|
||||
caf::pdmFromVariant( oldValue, oldPos );
|
||||
caf::fromVariant( oldValue, oldPos );
|
||||
|
||||
auto delta = m_referencePointUtmXyd() - oldPos;
|
||||
|
||||
|
||||
Reference in new issue
Block a user