#1830 AppFwk : Add level to PdmOptionItemInfo

This commit is contained in:
Magne Sjaastad 2017-09-05 10:34:52 +02:00
parent 642348ffed
commit 9eab559272
2 changed files with 34 additions and 7 deletions

View File

@ -46,7 +46,11 @@ namespace caf
///
//--------------------------------------------------------------------------------------------------
PdmOptionItemInfo::PdmOptionItemInfo(const QString& anOptionUiText, const QVariant& aValue, bool anIsDimmed /* = false */, QIcon anIcon /* = QIcon()*/)
: m_value(aValue), m_optionUiText(anOptionUiText), m_isDimmed(anIsDimmed), m_icon(anIcon)
: m_value(aValue),
m_optionUiText(anOptionUiText),
m_isDimmed(anIsDimmed),
m_icon(anIcon),
m_level(0)
{
}
@ -55,11 +59,22 @@ PdmOptionItemInfo::PdmOptionItemInfo(const QString& anOptionUiText, const QVaria
///
//--------------------------------------------------------------------------------------------------
PdmOptionItemInfo::PdmOptionItemInfo(const QString& anOptionUiText, caf::PdmObjectHandle* obj, bool anIsDimmed /*= false*/, QIcon anIcon /*= QIcon()*/)
: m_optionUiText(anOptionUiText), m_isDimmed(anIsDimmed), m_icon(anIcon)
: m_optionUiText(anOptionUiText),
m_isDimmed(anIsDimmed),
m_icon(anIcon),
m_level(0)
{
m_value = QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(obj));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PdmOptionItemInfo::setLevel(int level)
{
m_level = level;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -92,6 +107,14 @@ const QIcon PdmOptionItemInfo::icon() const
return m_icon;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int PdmOptionItemInfo::level() const
{
return m_level;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -86,13 +86,16 @@ private:
class PdmOptionItemInfo
{
public:
PdmOptionItemInfo(const QString& anOptionUiText, const QVariant& aValue, bool anIsDimmed = false, QIcon anIcon = QIcon() );
PdmOptionItemInfo(const QString& anOptionUiText, const QVariant& aValue, bool anIsDimmed = false, QIcon anIcon = QIcon());
PdmOptionItemInfo(const QString& anOptionUiText, caf::PdmObjectHandle* obj, bool anIsDimmed = false, QIcon anIcon = QIcon());
void setLevel(int level);
const QString optionUiText() const;
const QVariant value() const;
bool isDimmed() const;
const QIcon icon() const;
int level() const;
// Static utility methods to handle QList of PdmOptionItemInfo
@ -104,10 +107,11 @@ public:
std::vector<unsigned int>& foundIndexes);
private:
QString m_optionUiText;
QVariant m_value;
bool m_isDimmed;
QIcon m_icon;
QString m_optionUiText;
QVariant m_value;
bool m_isDimmed;
QIcon m_icon;
int m_level;
};
class PdmUiEditorHandle;