mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
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:
parent
f1d4de2090
commit
01ac756314
@ -85,6 +85,21 @@ void PdmUiEditorHandle::updateUi()
|
||||
emit uiUpdated();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiEditorHandle::updateUiIncludingParent()
|
||||
{
|
||||
if (m_parentEditor)
|
||||
{
|
||||
m_parentEditor->updateUiIncludingParent();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->updateUi();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user