mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-03 04:00:57 -06:00
Added dummy static class to fix issue with single macro in cpp
The implementation of this dummy class is put in the file with the single macro defining the UI editor. This will cause the cpp file to always be compiled.
This commit is contained in:
parent
ee78d3c148
commit
fd5bd534f6
@ -63,6 +63,7 @@ RimView::RimView(void)
|
||||
CAF_PDM_InitField(&showWindow, "ShowWindow", true, "Show 3D viewer", "", "", "");
|
||||
showWindow.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitField(&cameraPosition, "CameraPosition", cvf::Mat4d::IDENTITY, "", "", "", "");
|
||||
cameraPosition.uiCapability()->setUiHidden(true);
|
||||
|
||||
double defaultScaleFactor = 1.0;
|
||||
if (preferences) defaultScaleFactor = preferences->defaultScaleFactorZ;
|
||||
|
@ -41,3 +41,13 @@
|
||||
#include "cafPdmUiColorEditor.h"
|
||||
|
||||
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(caf::PdmUiColorEditor, cvf::Color3f);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// 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
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Color3fDummy::Color3fDummy()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -46,6 +46,12 @@
|
||||
|
||||
#include "cafPdmCoreColor3f.h"
|
||||
|
||||
class Color3fDummy
|
||||
{
|
||||
public:
|
||||
Color3fDummy();
|
||||
};
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
@ -56,6 +62,8 @@ public:
|
||||
/// Convert the field value into a QVariant
|
||||
static QVariant convert(const cvf::Color3f& value)
|
||||
{
|
||||
static Color3fDummy dummy;
|
||||
|
||||
return PdmValueFieldSpecialization< cvf::Color3f >::convert(value);
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,14 @@
|
||||
#include "cafPdmProxyValueField.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
|
||||
// TODO: This macro is never run, because this compile unit is never touched
|
||||
// See RPM EvcSplitElementUi where it is needed to set up an editor for a cvf::Vec3d
|
||||
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(caf::PdmUiLineEditor, cvf::Vec3d);
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// 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
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Vec3dDummy::Vec3dDummy()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -46,6 +46,13 @@
|
||||
|
||||
#include "cafPdmCoreVec3d.h"
|
||||
|
||||
class Vec3dDummy
|
||||
{
|
||||
public:
|
||||
Vec3dDummy();
|
||||
};
|
||||
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
@ -56,6 +63,8 @@ public:
|
||||
/// Convert the field value into a QVariant
|
||||
static QVariant convert(const cvf::Vec3d& value)
|
||||
{
|
||||
static Vec3dDummy dummy;
|
||||
|
||||
return PdmValueFieldSpecialization< cvf::Vec3d >::convert(value);
|
||||
}
|
||||
|
||||
|
@ -257,6 +257,16 @@ void PdmUiDefaultObjectEditor::recursiveSetupFieldsAndGroups(const std::vector<P
|
||||
m_fieldViews[field->fieldHandle()->keyword()] = fieldEditor;
|
||||
fieldEditor->createWidgets(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This assert happens if no editor is available for a given field
|
||||
// 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
|
||||
//
|
||||
// See cafPdmUiCoreColor3f and cafPdmUiCoreVec3d
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user