#3222 AppFwk : Improve robustness/maintainability (2)

This commit is contained in:
Magne Sjaastad 2018-08-16 22:03:31 +02:00
parent cd63332514
commit 26f6eb1dd4
9 changed files with 14 additions and 16 deletions

View File

@ -50,16 +50,14 @@ class PdmUiItem;
/// Abstract class to handle editors. Inherits QObject to be able to use signals and slots /// Abstract class to handle editors. Inherits QObject to be able to use signals and slots
//================================================================================================== //==================================================================================================
class PdmUiEditorHandle: public QObject class PdmUiEditorHandle : public QObject
{ {
public: public:
PdmUiEditorHandle(); PdmUiEditorHandle();
virtual ~PdmUiEditorHandle(); virtual ~PdmUiEditorHandle();
public: public:
void updateUi(const QString& uiConfigName);; void updateUi(const QString& uiConfigName);;
void updateUi();; void updateUi();;
protected: protected:
@ -99,7 +97,7 @@ public:
protected: // Interface to override: protected: // Interface to override:
/// Supposed to update all parts of the widgets, both visibility, sensitivity, decorations and field data /// Supposed to update all parts of the widgets, both visibility, sensitivity, decorations and field data
virtual void configureAndUpdateUi(const QString& uiConfigName) void configureAndUpdateUi(const QString& uiConfigName) override
{ {
if (m_mainEditorHandle) if (m_mainEditorHandle)
{ {

View File

@ -41,7 +41,7 @@ QVariant PdmUiFieldHandle::uiValue() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> PdmUiFieldHandle::valueOptions(bool* useOptionsOnly) const QList<caf::PdmOptionItemInfo> PdmUiFieldHandle::valueOptions(bool* useOptionsOnly)
{ {
return QList<PdmOptionItemInfo>(); return QList<PdmOptionItemInfo>();
} }

View File

@ -20,7 +20,7 @@ public:
// The QVariant encapsulates the real value, or an index into the valueOptions // The QVariant encapsulates the real value, or an index into the valueOptions
virtual QVariant uiValue() const; virtual QVariant uiValue() const;
virtual QList<PdmOptionItemInfo> valueOptions(bool* useOptionsOnly) const; virtual QList<PdmOptionItemInfo> valueOptions(bool* useOptionsOnly);
void notifyFieldChanged(const QVariant& oldUiBasedQVariant, const QVariant& newUiBasedQVariant) override; void notifyFieldChanged(const QVariant& oldUiBasedQVariant, const QVariant& newUiBasedQVariant) override;

View File

@ -75,7 +75,7 @@ QString PdmUiGroup::keyword() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool PdmUiGroup::isUiGroup() bool PdmUiGroup::isUiGroup() const
{ {
return true; return true;
} }

View File

@ -54,7 +54,7 @@ public:
void setKeyword(const QString& keyword); void setKeyword(const QString& keyword);
QString keyword() const; QString keyword() const;
bool isUiGroup() override; bool isUiGroup() const override;
/// Set this group to be collapsed by default. When the user expands the group, the default no longer has any effect. /// Set this group to be collapsed by default. When the user expands the group, the default no longer has any effect.
void setCollapsedByDefault(bool doCollapse); void setCollapsedByDefault(bool doCollapse);

View File

@ -397,7 +397,7 @@ void PdmUiItem::setUiEditorTypeName(const QString& editorTypeName, const QString
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool PdmUiItem::isUiGroup() bool PdmUiItem::isUiGroup() const
{ {
return false; return false;
} }
@ -483,7 +483,7 @@ const PdmUiItemInfo* PdmUiItem::defaultInfo() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void PdmUiItem::updateConnectedEditors() void PdmUiItem::updateConnectedEditors() const
{ {
std::set<PdmUiEditorHandle*>::iterator it; std::set<PdmUiEditorHandle*>::iterator it;
for (it = m_editors.begin(); it != m_editors.end(); ++it) for (it = m_editors.begin(); it != m_editors.end(); ++it)
@ -495,7 +495,7 @@ void PdmUiItem::updateConnectedEditors()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void PdmUiItem::updateAllRequiredEditors() void PdmUiItem::updateAllRequiredEditors() const
{ {
updateConnectedEditors(); updateConnectedEditors();

View File

@ -232,13 +232,13 @@ public:
QString uiEditorTypeName(const QString& uiConfigName) const; QString uiEditorTypeName(const QString& uiConfigName) const;
void setUiEditorTypeName(const QString& editorTypeName, const QString& uiConfigName = ""); void setUiEditorTypeName(const QString& editorTypeName, const QString& uiConfigName = "");
virtual bool isUiGroup(); virtual bool isUiGroup() const;
/// Intended to be called when fields in an object has been changed /// Intended to be called when fields in an object has been changed
void updateConnectedEditors(); void updateConnectedEditors() const;
/// Intended to be called when an object has been created or deleted /// Intended to be called when an object has been created or deleted
void updateAllRequiredEditors(); void updateAllRequiredEditors() const;
void updateUiIconFromState(bool isActive, const QString& uiConfigName = ""); void updateUiIconFromState(bool isActive, const QString& uiConfigName = "");

View File

@ -165,7 +165,7 @@ caf::PdmUiGroup* PdmUiOrdering::createGroupWithIdBeforeItem(const PdmUiItem* ite
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
caf::PdmUiGroup* PdmUiOrdering::findGroup(const QString& groupId) caf::PdmUiGroup* PdmUiOrdering::findGroup(const QString& groupId) const
{ {
return findGroupPosition(groupId).group(); return findGroupPosition(groupId).group();
} }

View File

@ -74,7 +74,7 @@ public:
PdmUiGroup* createGroupWithIdBeforeGroup(const QString& groupId, const QString& displayName, const QString& newGroupId); PdmUiGroup* createGroupWithIdBeforeGroup(const QString& groupId, const QString& displayName, const QString& newGroupId);
PdmUiGroup* createGroupWithIdBeforeItem(const PdmUiItem* item, const QString& displayName, const QString& newGroupId); PdmUiGroup* createGroupWithIdBeforeItem(const PdmUiItem* item, const QString& displayName, const QString& newGroupId);
PdmUiGroup* findGroup(const QString& groupId); PdmUiGroup* findGroup(const QString& groupId) const;
void skipRemainingFields(bool doSkip = true); void skipRemainingFields(bool doSkip = true);