mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Use a special flag to indicate hidden children of a field.
Added new method in PdmUiItem called isUiHideChildren() p4#: 22093
This commit is contained in:
parent
50777b3e3f
commit
ffbb0b6a46
@ -49,6 +49,7 @@ RimResultSlot::RimResultSlot()
|
|||||||
CAF_PDM_InitFieldNoDefault(&legendConfig, "LegendDefinition", "Legend Definition", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&legendConfig, "LegendDefinition", "Legend Definition", "", "", "");
|
||||||
CAF_PDM_InitFieldNoDefault(&m_legendConfigData, "ResultVarLegendDefinitionList", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_legendConfigData, "ResultVarLegendDefinitionList", "", "", "", "");
|
||||||
m_legendConfigData.setUiHidden(true);
|
m_legendConfigData.setUiHidden(true);
|
||||||
|
m_legendConfigData.setUiHideChildren(true);
|
||||||
|
|
||||||
legendConfig = new RimLegendConfig();
|
legendConfig = new RimLegendConfig();
|
||||||
}
|
}
|
||||||
|
@ -164,6 +164,22 @@ bool PdmUiItem::isUiHidden(QString uiConfigName) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool PdmUiItem::isUiHideChildren(QString uiConfigName) const
|
||||||
|
{
|
||||||
|
const PdmUiItemInfo* conInfo = configInfo(uiConfigName);
|
||||||
|
const PdmUiItemInfo* defInfo = defaultInfo();
|
||||||
|
const PdmUiItemInfo* sttInfo = m_staticItemInfo;
|
||||||
|
|
||||||
|
if (conInfo && !(conInfo->m_hideChildren == -1)) return conInfo->m_hideChildren;
|
||||||
|
if (defInfo && !(defInfo->m_hideChildren == -1)) return defInfo->m_hideChildren;
|
||||||
|
if (sttInfo && !(sttInfo->m_hideChildren == -1)) return sttInfo->m_hideChildren;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -35,12 +35,12 @@ class PdmUiItemInfo
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PdmUiItemInfo()
|
PdmUiItemInfo()
|
||||||
: m_editorTypeName(""), m_isHidden(-1) , m_isReadOnly(-1)
|
: m_editorTypeName(""), m_isHidden(-1), m_hideChildren(-1), m_isReadOnly(-1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
PdmUiItemInfo( QString uiName, QIcon icon = QIcon(), QString toolTip = "", QString whatsThis = "")
|
PdmUiItemInfo( QString uiName, QIcon icon = QIcon(), QString toolTip = "", QString whatsThis = "")
|
||||||
: m_uiName(uiName), m_icon(icon), m_toolTip(toolTip), m_whatsThis(whatsThis),
|
: m_uiName(uiName), m_icon(icon), m_toolTip(toolTip), m_whatsThis(whatsThis),
|
||||||
m_editorTypeName(""), m_isHidden(false), m_isReadOnly(false), m_labelAlignment(LEFT)
|
m_editorTypeName(""), m_isHidden(false), m_hideChildren(false), m_isReadOnly(false), m_labelAlignment(LEFT)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
enum LabelPosType { LEFT, TOP, HIDDEN };
|
enum LabelPosType { LEFT, TOP, HIDDEN };
|
||||||
@ -52,8 +52,9 @@ private:
|
|||||||
QString m_whatsThis;
|
QString m_whatsThis;
|
||||||
QIcon m_icon;
|
QIcon m_icon;
|
||||||
QString m_editorTypeName; ///< Use this exact type of editor to edit this UiItem
|
QString m_editorTypeName; ///< Use this exact type of editor to edit this UiItem
|
||||||
int m_isHidden; ///< UiItem should be hidden. -1 means not set
|
int m_isHidden; ///< UiItem should be hidden. -1 means not set
|
||||||
int m_isReadOnly; ///< UiItem should be insensitive, or read only. -1 means not set.
|
int m_hideChildren; ///< Children of UiItem should be hidden. -1 means not set
|
||||||
|
int m_isReadOnly; ///< UiItem should be insensitive, or read only. -1 means not set.
|
||||||
LabelPosType m_labelAlignment;
|
LabelPosType m_labelAlignment;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -115,6 +116,9 @@ public:
|
|||||||
bool isUiHidden(QString uiConfigName = "") const;
|
bool isUiHidden(QString uiConfigName = "") const;
|
||||||
void setUiHidden(bool isHidden, QString uiConfigName = "") { m_configItemInfos[uiConfigName].m_isHidden = isHidden; }
|
void setUiHidden(bool isHidden, QString uiConfigName = "") { m_configItemInfos[uiConfigName].m_isHidden = isHidden; }
|
||||||
|
|
||||||
|
bool isUiHideChildren(QString uiConfigName = "") const;
|
||||||
|
void setUiHideChildren(bool isHideChildren, QString uiConfigName = "") { m_configItemInfos[uiConfigName].m_hideChildren = isHideChildren; }
|
||||||
|
|
||||||
bool isUiReadOnly(QString uiConfigName = "");
|
bool isUiReadOnly(QString uiConfigName = "");
|
||||||
void setUiReadOnly(bool isReadOnly, QString uiConfigName = "") { m_configItemInfos[uiConfigName].m_isReadOnly = isReadOnly; }
|
void setUiReadOnly(bool isReadOnly, QString uiConfigName = "") { m_configItemInfos[uiConfigName].m_isReadOnly = isReadOnly; }
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ PdmUiTreeItem* UiTreeItemBuilderPdm::buildViewItems(PdmUiTreeItem* parentTreeIte
|
|||||||
// Fix for hidden legend definitions. There is only one visible legend definition, the others reside in a hidden container
|
// Fix for hidden legend definitions. There is only one visible legend definition, the others reside in a hidden container
|
||||||
// Todo: This is a Hack. Must be rewritten when a more general ui tree building method is in place.
|
// Todo: This is a Hack. Must be rewritten when a more general ui tree building method is in place.
|
||||||
// See comment at top of this method.
|
// See comment at top of this method.
|
||||||
if (field->isUiHidden())
|
if (field->isUiHideChildren())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user