mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4423 First implementation of PdmObject exchange
This commit is contained in:
@@ -26,6 +26,9 @@
|
||||
CAF_PDM_InitField(field, keyword, default, uiName, iconResourceName, toolTip, whatsThis); \
|
||||
AddRicfCapabilityToField(field)
|
||||
|
||||
#define RICF_InitFieldNoDefault(field, keyword, uiName, iconResourceName, toolTip, whatsThis) \
|
||||
CAF_PDM_InitFieldNoDefault(field, keyword, uiName, iconResourceName, toolTip, whatsThis); \
|
||||
AddRicfCapabilityToField(field)
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
#include "RicfFieldCapability.h"
|
||||
#include "RicfMessages.h"
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
|
||||
#include <QColor>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -130,3 +132,28 @@ void RicfFieldWriter<bool>::writeFieldData(const bool& fieldValue, QTextStream&
|
||||
// Lower-case true/false is used in the documentation.
|
||||
outputStream << (fieldValue ? "true" : "false");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfFieldReader<cvf::Color3f>::readFieldData(cvf::Color3f& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer)
|
||||
{
|
||||
QString fieldStringValue;
|
||||
RicfFieldReader<QString>::readFieldData(fieldStringValue, inputStream, errorMessageContainer);
|
||||
|
||||
if (QColor::isValidColor(fieldStringValue))
|
||||
{
|
||||
QColor qColor(fieldStringValue);
|
||||
fieldValue = RiaColorTools::fromQColorTo3f(qColor);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfFieldWriter<cvf::Color3f>::writeFieldData(const cvf::Color3f& fieldValue, QTextStream& outputStream)
|
||||
{
|
||||
QColor qColor = RiaColorTools::toQColor(fieldValue);
|
||||
QString fieldStringValue = qColor.name();
|
||||
RicfFieldWriter<QString>::writeFieldData(fieldStringValue, outputStream);
|
||||
}
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "RicfMessages.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfColor3.h"
|
||||
|
||||
#include <QTextStream>
|
||||
#include <QString>
|
||||
@@ -77,6 +79,17 @@ struct RicfFieldWriter<bool>
|
||||
static void writeFieldData(const bool& fieldValue, QTextStream& outputStream);
|
||||
};
|
||||
|
||||
template<>
|
||||
struct RicfFieldReader<cvf::Color3f>
|
||||
{
|
||||
static void readFieldData(cvf::Color3f& fieldValue, QTextStream& inputStream, RicfMessages* errorMessageContainer);
|
||||
};
|
||||
|
||||
template<>
|
||||
struct RicfFieldWriter<cvf::Color3f>
|
||||
{
|
||||
static void writeFieldData(const cvf::Color3f& fieldValue, QTextStream& outputStream);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct RicfFieldReader< caf::AppEnum<T> >
|
||||
|
||||
Reference in New Issue
Block a user