AppFwk: Added a parent editor concept, and adjusted the update regime to make embedded editors trigger update of the containing editor. Removed the update of the fields owner object, which causes trouble for table editors and some derived object editors.

This commit is contained in:
Jacob Støren 2019-03-29 14:46:31 +01:00 committed by Magne Sjaastad
parent f1d4de2090
commit 01ac756314
4 changed files with 26 additions and 2 deletions

View File

@ -85,6 +85,21 @@ void PdmUiEditorHandle::updateUi()
emit uiUpdated();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PdmUiEditorHandle::updateUiIncludingParent()
{
if (m_parentEditor)
{
m_parentEditor->updateUiIncludingParent();
}
else
{
this->updateUi();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -40,6 +40,7 @@
#include "cafPdmUiItem.h"
#include <QObject>
#include <QPointer>
namespace caf
{
@ -61,6 +62,8 @@ public:
void updateUi(const QString& uiConfigName);;
void updateUi();
void updateUiIncludingParent();
signals:
void uiUpdated();
@ -76,12 +79,16 @@ protected:
void bindToPdmItem(PdmUiItem* item);
PdmUiItem* pdmItem() { return m_pdmItem; }
const PdmUiItem* pdmItem() const { return m_pdmItem; }
public: // PDM Internal
void setParentEditor(PdmUiEditorHandle* parentEditor) { m_parentEditor = parentEditor; }
private:
friend PdmUiItem::~PdmUiItem();
PdmUiItem* m_pdmItem;
QString m_currentConfigName;
QPointer<PdmUiEditorHandle> m_parentEditor; // Editor containing this editor. Will be asked to updateUi (instead of this) if it exists
bool m_isConfiguringUi;
};

View File

@ -81,7 +81,7 @@ void PdmUiFieldHandle::notifyFieldChanged(const QVariant& oldFieldValue, const Q
}
}
// Update field editors
// Update connected field editors or their parent editors, to make the ui reflect the change
this->updateConnectedEditors();
PdmUiModelChangeDetector::instance()->setModelChanged();

View File

@ -613,7 +613,9 @@ void PdmUiItem::updateConnectedEditors() const
std::set<PdmUiEditorHandle*>::iterator it;
for (it = m_editors.begin(); it != m_editors.end(); ++it)
{
(*it)->updateUi();
(*it)->updateUiIncludingParent();
//(*it)->updateUi();
}
}