AppFwk: Make PdmUiSelection3dEditorVisualizer generic, ready to be moved to a separate file

This commit is contained in:
Jacob Støren
2018-11-26 21:50:46 +01:00
parent 9297c5888c
commit fb93ad7ca7
7 changed files with 84 additions and 27 deletions

View File

@@ -418,6 +418,30 @@ void PdmUiItem::setUiEditorTypeName(const QString& editorTypeName, const QString
m_configItemInfos[uiConfigName].m_editorTypeName = editorTypeName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString PdmUiItem::ui3dEditorTypeName(const QString& uiConfigName) const
{
const PdmUiItemInfo* conInfo = configInfo(uiConfigName);
const PdmUiItemInfo* defInfo = defaultInfo();
const PdmUiItemInfo* sttInfo = m_staticItemInfo;
if (conInfo && !(conInfo->m_3dEditorTypeName.isEmpty())) return conInfo->m_3dEditorTypeName;
if (defInfo && !(defInfo->m_3dEditorTypeName.isEmpty())) return defInfo->m_3dEditorTypeName;
if (sttInfo && !(sttInfo->m_3dEditorTypeName.isEmpty())) return sttInfo->m_3dEditorTypeName;
return QString();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PdmUiItem::setUi3dEditorTypeName(const QString& editorTypeName, const QString& uiConfigName /*= ""*/)
{
m_configItemInfos[uiConfigName].m_3dEditorTypeName = editorTypeName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -56,12 +56,26 @@ class PdmUiItemInfo
{
public:
PdmUiItemInfo()
: m_editorTypeName(""), m_isHidden(-1), m_isTreeChildrenHidden(-1), m_isReadOnly(-1), m_labelAlignment(LEFT), m_isCustomContextMenuEnabled(-1)
: 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_isCustomContextMenuEnabled(false)
: 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_isCustomContextMenuEnabled(false)
{ }
enum LabelPosType { LEFT, TOP, HIDDEN };
@@ -75,6 +89,7 @@ private:
QString m_whatsThis;
QString m_extraDebugText;
QString m_editorTypeName; ///< Use this exact type of editor to edit this UiItem
QString m_3dEditorTypeName; ///< If set, use this editor type to edit this UiItem in 3D
int m_isHidden; ///< UiItem should be hidden. -1 means not set
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.
@@ -236,6 +251,9 @@ public:
QString uiEditorTypeName(const QString& uiConfigName) const;
void setUiEditorTypeName(const QString& editorTypeName, const QString& uiConfigName = "");
QString ui3dEditorTypeName(const QString& uiConfigName) const;
void setUi3dEditorTypeName(const QString& editorTypeName, const QString& uiConfigName = "");
virtual bool isUiGroup() const;
/// Intended to be called when fields in an object has been changed