mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
[Fwk] Static initializer must be placed at file global scope in order to always call the constructor in the cpp file
This commit is contained in:
@@ -45,11 +45,6 @@
|
|||||||
|
|
||||||
#include "cafPdmCoreColor3f.h"
|
#include "cafPdmCoreColor3f.h"
|
||||||
|
|
||||||
class Color3fDummy
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Color3fDummy();
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
@@ -61,8 +56,6 @@ public:
|
|||||||
/// Convert the field value into a QVariant
|
/// Convert the field value into a QVariant
|
||||||
static QVariant convert(const cvf::Color3f& value)
|
static QVariant convert(const cvf::Color3f& value)
|
||||||
{
|
{
|
||||||
static Color3fDummy dummy;
|
|
||||||
|
|
||||||
return PdmValueFieldSpecialization< cvf::Color3f >::convert(value);
|
return PdmValueFieldSpecialization< cvf::Color3f >::convert(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,3 +85,15 @@ public:
|
|||||||
|
|
||||||
} // end namespace caf
|
} // end namespace caf
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
// If the macro for registering the editor is put as the single statement
|
||||||
|
// in a cpp file, a dummy static class must be used to make sure the compile unit
|
||||||
|
// is included
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
class Color3fDummy
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Color3fDummy();
|
||||||
|
};
|
||||||
|
static Color3fDummy cafPdmColor3fDummy;
|
||||||
|
|||||||
@@ -46,13 +46,6 @@
|
|||||||
#include "cvfVector3.h"
|
#include "cvfVector3.h"
|
||||||
|
|
||||||
|
|
||||||
class Vec3dDummy
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Vec3dDummy();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -63,12 +56,9 @@ public:
|
|||||||
/// Convert the field value into a QVariant
|
/// Convert the field value into a QVariant
|
||||||
static QVariant convert(const cvf::Vec3d& value)
|
static QVariant convert(const cvf::Vec3d& value)
|
||||||
{
|
{
|
||||||
static Vec3dDummy dummy;
|
|
||||||
|
|
||||||
return PdmValueFieldSpecialization< cvf::Vec3d >::convert(value);
|
return PdmValueFieldSpecialization< cvf::Vec3d >::convert(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Set the field value from a QVariant
|
/// Set the field value from a QVariant
|
||||||
static void setFromVariant(const QVariant& variantValue, cvf::Vec3d& value)
|
static void setFromVariant(const QVariant& variantValue, cvf::Vec3d& value)
|
||||||
{
|
{
|
||||||
@@ -89,8 +79,20 @@ public:
|
|||||||
/// Methods to retrieve the possible PdmObject pointed to by a field
|
/// Methods to retrieve the possible PdmObject pointed to by a field
|
||||||
static void childObjects(const PdmDataValueField< cvf::Vec3d >&, std::vector<PdmObjectHandle*>*)
|
static void childObjects(const PdmDataValueField< cvf::Vec3d >&, std::vector<PdmObjectHandle*>*)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace caf
|
} // end namespace caf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
// If the macro for registering the editor is put as the single statement
|
||||||
|
// in a cpp file, a dummy static class must be used to make sure the compile unit
|
||||||
|
// is included
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
class Vec3dDummy
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Vec3dDummy();
|
||||||
|
};
|
||||||
|
static Vec3dDummy cafPdmVec3dDummy;
|
||||||
|
|||||||
Reference in New Issue
Block a user