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
|
} //End of namespace caf
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
|
#include "cafPdmChildArrayField.h"
|
||||||
|
|
||||||
#include <QXmlStreamWriter>
|
#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
|
} // End of namespace caf
|
||||||
|
|
||||||
|
@ -37,8 +37,9 @@
|
|||||||
|
|
||||||
#include "cafPdmUiListView.h"
|
#include "cafPdmUiListView.h"
|
||||||
|
|
||||||
#include "cafPdmUiListViewEditor.h"
|
#include "cafPdmObjectGroup.h"
|
||||||
#include "cafPdmObjectHandle.h"
|
#include "cafPdmObjectHandle.h"
|
||||||
|
#include "cafPdmUiListViewEditor.h"
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
@ -79,7 +80,7 @@ PdmUiListView::~PdmUiListView()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void PdmUiListView::setPdmObject(caf::PdmObjectHandle* object)
|
void PdmUiListView::setPdmObject(caf::PdmGuardedObjects* object)
|
||||||
{
|
{
|
||||||
assert(m_listViewEditor);
|
assert(m_listViewEditor);
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class QVBoxLayout;
|
|||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
|
|
||||||
class PdmObjectHandle;
|
class PdmGuardedObjects;
|
||||||
class PdmUiListViewEditor;
|
class PdmUiListViewEditor;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@ -57,7 +57,7 @@ public:
|
|||||||
PdmUiListView(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
PdmUiListView(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||||
~PdmUiListView();
|
~PdmUiListView();
|
||||||
|
|
||||||
void setPdmObject(caf::PdmObjectHandle* object);
|
void setPdmObject(caf::PdmGuardedObjects* object);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PdmUiListViewEditor* m_listViewEditor;
|
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_pdmObjectGroup = objectGroup;
|
||||||
m_configName = configName;
|
m_configName = configName;
|
||||||
@ -244,7 +244,7 @@ QWidget* PdmUiListViewEditor::createWidget(QWidget* parent)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void PdmUiListViewEditor::configureAndUpdateUi(const QString& uiConfigName)
|
void PdmUiListViewEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||||
{
|
{
|
||||||
PdmObjectGroup* objectGroup = dynamic_cast<PdmObjectGroup*>(pdmObject());
|
PdmGuardedObjects* objectGroup = dynamic_cast<PdmGuardedObjects*>(pdmObject());
|
||||||
m_tableModelPdm->setPdmData(objectGroup, uiConfigName);
|
m_tableModelPdm->setPdmData(objectGroup, uiConfigName);
|
||||||
|
|
||||||
m_tableView->resizeColumnsToContents();
|
m_tableView->resizeColumnsToContents();
|
||||||
|
@ -50,7 +50,7 @@ namespace caf
|
|||||||
{
|
{
|
||||||
class PdmUiFieldEditorHandle;
|
class PdmUiFieldEditorHandle;
|
||||||
class PdmUiItem;
|
class PdmUiItem;
|
||||||
class PdmObjectGroup;
|
class PdmGuardedObjects;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ class UiListViewModelPdm : public QAbstractTableModel
|
|||||||
public:
|
public:
|
||||||
UiListViewModelPdm(QObject* parent);
|
UiListViewModelPdm(QObject* parent);
|
||||||
|
|
||||||
void setPdmData(PdmObjectGroup* objectGroup, const QString& configName);
|
void setPdmData(PdmGuardedObjects* objectGroup, const QString& configName);
|
||||||
|
|
||||||
// Qt overrides
|
// Qt overrides
|
||||||
virtual int rowCount( const QModelIndex &parent = QModelIndex( ) ) const;
|
virtual int rowCount( const QModelIndex &parent = QModelIndex( ) ) const;
|
||||||
@ -92,7 +92,7 @@ private:
|
|||||||
void computeColumnCount();
|
void computeColumnCount();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PdmObjectGroup* m_pdmObjectGroup;
|
PdmGuardedObjects* m_pdmObjectGroup;
|
||||||
QString m_configName;
|
QString m_configName;
|
||||||
PdmUiListViewEditorAttribute m_editorAttribute;
|
PdmUiListViewEditorAttribute m_editorAttribute;
|
||||||
int m_columnCount;
|
int m_columnCount;
|
||||||
|
Loading…
Reference in New Issue
Block a user