mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-24 15:26:48 -06:00
#3048 AppFwk : Add setCustomContextMenuEnabled to PdmUiItem
This commit is contained in:
parent
2f0b1cfdb9
commit
e8204465f9
@ -335,6 +335,22 @@ PdmUiItemInfo::LabelPosType PdmUiItem::uiLabelPosition(QString uiConfigName) con
|
||||
return PdmUiItemInfo::LEFT;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool PdmUiItem::isCustomContextMenuEnabled(QString uiConfigName /*= ""*/) const
|
||||
{
|
||||
const PdmUiItemInfo* conInfo = configInfo(uiConfigName);
|
||||
const PdmUiItemInfo* defInfo = defaultInfo();
|
||||
const PdmUiItemInfo* sttInfo = m_staticItemInfo;
|
||||
|
||||
if (conInfo && (conInfo->m_isCustomContextMenuEnabled != -1)) return conInfo->m_isCustomContextMenuEnabled;
|
||||
if (defInfo && (defInfo->m_isCustomContextMenuEnabled != -1)) return defInfo->m_isCustomContextMenuEnabled;
|
||||
if (sttInfo && (sttInfo->m_isCustomContextMenuEnabled != -1)) return sttInfo->m_isCustomContextMenuEnabled;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -56,12 +56,12 @@ class PdmUiItemInfo
|
||||
{
|
||||
public:
|
||||
PdmUiItemInfo()
|
||||
: m_editorTypeName(""), m_isHidden(-1), m_isTreeChildrenHidden(-1), m_isReadOnly(-1), m_labelAlignment(LEFT)
|
||||
: m_editorTypeName(""), m_isHidden(-1), m_isTreeChildrenHidden(-1), m_isReadOnly(-1), m_labelAlignment(LEFT), m_isCustomContextMenuEnabled(-1)
|
||||
{}
|
||||
|
||||
PdmUiItemInfo(const QString& uiName, QIcon icon = QIcon(), QString toolTip = "", QString whatsThis = "", QString extraDebugText = "")
|
||||
: m_uiName(uiName), m_icon(icon), m_toolTip(toolTip), m_whatsThis(whatsThis), m_extraDebugText(extraDebugText),
|
||||
m_editorTypeName(""), m_isHidden(false), m_isTreeChildrenHidden(false), m_isReadOnly(false), m_labelAlignment(LEFT)
|
||||
m_editorTypeName(""), m_isHidden(false), m_isTreeChildrenHidden(false), m_isReadOnly(false), m_labelAlignment(LEFT), m_isCustomContextMenuEnabled(false)
|
||||
{ }
|
||||
|
||||
enum LabelPosType { LEFT, TOP, HIDDEN };
|
||||
@ -78,6 +78,7 @@ private:
|
||||
int m_isTreeChildrenHidden; ///< 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;
|
||||
int m_isCustomContextMenuEnabled;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
@ -225,6 +226,9 @@ public:
|
||||
uiLabelPosition(QString uiConfigName = "") const;
|
||||
void setUiLabelPosition(PdmUiItemInfo::LabelPosType alignment, QString uiConfigName = "") { m_configItemInfos[uiConfigName].m_labelAlignment = alignment; }
|
||||
|
||||
bool isCustomContextMenuEnabled(QString uiConfigName = "") const;
|
||||
void setCustomContextMenuEnabled(bool enableCustomContextMenu, QString uiConfigName = "") { m_configItemInfos[uiConfigName].m_isCustomContextMenuEnabled = enableCustomContextMenu; }
|
||||
|
||||
QString uiEditorTypeName(const QString& uiConfigName) const;
|
||||
void setUiEditorTypeName(const QString& editorTypeName, QString uiConfigName = "") { m_configItemInfos[uiConfigName].m_editorTypeName = editorTypeName; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user