AppFwk : Clear internal structures when object changes

This commit is contained in:
Magne Sjaastad 2016-10-11 15:31:20 +02:00
parent 3f97640e7a
commit b8f1099d32
2 changed files with 27 additions and 2 deletions

View File

@ -171,6 +171,30 @@ void PdmUiDefaultObjectEditor::configureAndUpdateUi(const QString& uiConfigName)
m_groupBoxes = m_newGroupBoxes; m_groupBoxes = m_newGroupBoxes;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PdmUiDefaultObjectEditor::cleanupBeforeSettingPdmObject()
{
std::map<QString, PdmUiFieldEditorHandle*>::iterator it;
for (it = m_fieldViews.begin(); it != m_fieldViews.end(); ++it)
{
PdmUiFieldEditorHandle* fvh = it->second;
delete fvh;
}
m_fieldViews.clear();
m_newGroupBoxes.clear();
std::map<QString, QPointer<QGroupBox> >::iterator groupIt;
for (groupIt = m_groupBoxes.begin(); groupIt != m_groupBoxes.end(); ++groupIt)
{
if (!groupIt->second.isNull()) groupIt->second->deleteLater();
}
m_groupBoxes.clear();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -61,8 +61,9 @@ public:
~PdmUiDefaultObjectEditor(); ~PdmUiDefaultObjectEditor();
protected: protected:
virtual QWidget* createWidget(QWidget* parent); virtual QWidget* createWidget(QWidget* parent) override;
virtual void configureAndUpdateUi(const QString& uiConfigName); virtual void configureAndUpdateUi(const QString& uiConfigName) override;
virtual void cleanupBeforeSettingPdmObject() override;
private: private:
void recursiveSetupFieldsAndGroups(const std::vector<PdmUiItem*>& uiItems, QWidget* parent, QGridLayout* parentLayout, const QString& uiConfigName); void recursiveSetupFieldsAndGroups(const std::vector<PdmUiItem*>& uiItems, QWidget* parent, QGridLayout* parentLayout, const QString& uiConfigName);