mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added PdmGuardedObjects and use this container from UiListView
This commit is contained in:
parent
beb291e1ce
commit
c2fe5f3a16
@ -47,6 +47,24 @@ void PdmObjectGroup::addObject(PdmObjectHandle * obj)
|
||||
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(PdmGuardedObjects, "PdmGuardedObjects");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
PdmGuardedObjects::PdmGuardedObjects()
|
||||
{
|
||||
CAF_PDM_InitObject("PdmGuardedObjects", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&objects, "PdmObjects", "", "", "", "")
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
PdmGuardedObjects::~PdmGuardedObjects()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
} //End of namespace caf
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
|
||||
#include <QXmlStreamWriter>
|
||||
|
||||
@ -89,6 +90,16 @@ void PdmObjectGroup::createCopyByType(std::vector<PdmPointer<T> >* copyOfTypedOb
|
||||
}
|
||||
|
||||
|
||||
class PdmGuardedObjects : public PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
PdmGuardedObjects();
|
||||
~PdmGuardedObjects();
|
||||
|
||||
caf::PdmChildArrayField<PdmObjectHandle*> objects;
|
||||
};
|
||||
|
||||
|
||||
} // End of namespace caf
|
||||
|
||||
|
@ -37,8 +37,9 @@
|
||||
|
||||
#include "cafPdmUiListView.h"
|
||||
|
||||
#include "cafPdmUiListViewEditor.h"
|
||||
#include "cafPdmObjectGroup.h"
|
||||
#include "cafPdmObjectHandle.h"
|
||||
#include "cafPdmUiListViewEditor.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
|
||||
@ -79,7 +80,7 @@ PdmUiListView::~PdmUiListView()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiListView::setPdmObject(caf::PdmObjectHandle* object)
|
||||
void PdmUiListView::setPdmObject(caf::PdmGuardedObjects* object)
|
||||
{
|
||||
assert(m_listViewEditor);
|
||||
|
||||
|
@ -44,7 +44,7 @@ class QVBoxLayout;
|
||||
namespace caf
|
||||
{
|
||||
|
||||
class PdmObjectHandle;
|
||||
class PdmGuardedObjects;
|
||||
class PdmUiListViewEditor;
|
||||
|
||||
//==================================================================================================
|
||||
@ -57,7 +57,7 @@ public:
|
||||
PdmUiListView(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||
~PdmUiListView();
|
||||
|
||||
void setPdmObject(caf::PdmObjectHandle* object);
|
||||
void setPdmObject(caf::PdmGuardedObjects* object);
|
||||
|
||||
private:
|
||||
PdmUiListViewEditor* m_listViewEditor;
|
||||
|
@ -184,7 +184,7 @@ QVariant caf::UiListViewModelPdm::data(const QModelIndex &index, int role /*= Qt
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void caf::UiListViewModelPdm::setPdmData(PdmObjectGroup* objectGroup, const QString& configName)
|
||||
void caf::UiListViewModelPdm::setPdmData(PdmGuardedObjects* objectGroup, const QString& configName)
|
||||
{
|
||||
m_pdmObjectGroup = objectGroup;
|
||||
m_configName = configName;
|
||||
@ -244,7 +244,7 @@ QWidget* PdmUiListViewEditor::createWidget(QWidget* parent)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiListViewEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
{
|
||||
PdmObjectGroup* objectGroup = dynamic_cast<PdmObjectGroup*>(pdmObject());
|
||||
PdmGuardedObjects* objectGroup = dynamic_cast<PdmGuardedObjects*>(pdmObject());
|
||||
m_tableModelPdm->setPdmData(objectGroup, uiConfigName);
|
||||
|
||||
m_tableView->resizeColumnsToContents();
|
||||
|
@ -50,7 +50,7 @@ namespace caf
|
||||
{
|
||||
class PdmUiFieldEditorHandle;
|
||||
class PdmUiItem;
|
||||
class PdmObjectGroup;
|
||||
class PdmGuardedObjects;
|
||||
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ class UiListViewModelPdm : public QAbstractTableModel
|
||||
public:
|
||||
UiListViewModelPdm(QObject* parent);
|
||||
|
||||
void setPdmData(PdmObjectGroup* objectGroup, const QString& configName);
|
||||
void setPdmData(PdmGuardedObjects* objectGroup, const QString& configName);
|
||||
|
||||
// Qt overrides
|
||||
virtual int rowCount( const QModelIndex &parent = QModelIndex( ) ) const;
|
||||
@ -92,7 +92,7 @@ private:
|
||||
void computeColumnCount();
|
||||
|
||||
private:
|
||||
PdmObjectGroup* m_pdmObjectGroup;
|
||||
PdmGuardedObjects* m_pdmObjectGroup;
|
||||
QString m_configName;
|
||||
PdmUiListViewEditorAttribute m_editorAttribute;
|
||||
int m_columnCount;
|
||||
|
Loading…
Reference in New Issue
Block a user