mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
AppFwk: Split PdmUiObjectEditorHandle into PdmUiWidgetObjectEditorHandle
making PdmUiObjectEditorHandle a cleaner interface for PdmUi3dObjectEditorHandle
This commit is contained in:
parent
b9b1646576
commit
318cd76b64
@ -176,6 +176,8 @@ private:
|
||||
#include "cafSelectionChangedReceiver.h"
|
||||
#include "cafPdmUiObjectEditorHandle.h"
|
||||
#include "cafFactory.h"
|
||||
#include <QWidget>
|
||||
|
||||
// PdmUiObjectEditorHandle -<| PdmUiWidgetObjectEditorHandle --<| PdmUiFormLayoutObjectEditor
|
||||
// -<| PdmUi3dObjectEditorHandle
|
||||
namespace caf
|
||||
@ -211,9 +213,6 @@ public:
|
||||
protected:
|
||||
QWidget* ownerViewer() { return m_ownerViewer;}
|
||||
|
||||
// To be removed when splitting the PdmUiObjectEditorHandle
|
||||
QWidget* createWidget(QWidget* parent) override { return nullptr;}
|
||||
|
||||
private:
|
||||
|
||||
QPointer<QWidget> m_ownerViewer;
|
||||
|
@ -11,7 +11,7 @@ note right of [cafProjectDataModel]
|
||||
end note
|
||||
|
||||
|
||||
component cafPdmCore
|
||||
component cafPdmCore
|
||||
note right of [cafPdmCore]
|
||||
cafAppEnum
|
||||
Classes derived from cafPdmFieldHandle
|
||||
|
@ -39,6 +39,8 @@ set( PROJECT_FILES
|
||||
cafPdmUiModelChangeDetector.h
|
||||
cafPdmUiObjectEditorHandle.cpp
|
||||
cafPdmUiObjectEditorHandle.h
|
||||
cafPdmUiWidgetObjectEditorHandle.cpp
|
||||
cafPdmUiWidgetObjectEditorHandle.h
|
||||
cafPdmUiObjectHandle.cpp
|
||||
cafPdmUiObjectHandle.h
|
||||
cafPdmUiOrdering.cpp
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
|
||||
public:
|
||||
void updateUi(const QString& uiConfigName);;
|
||||
void updateUi();;
|
||||
void updateUi();
|
||||
|
||||
protected:
|
||||
// Interface to override:
|
||||
|
@ -34,10 +34,8 @@
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
|
||||
#include "cafPdmUiObjectEditorHandle.h"
|
||||
|
||||
#include "cafPdmObjectHandle.h"
|
||||
#include "cafPdmUiObjectHandle.h"
|
||||
|
||||
namespace caf
|
||||
@ -61,26 +59,6 @@ PdmUiObjectEditorHandle::~PdmUiObjectEditorHandle()
|
||||
m_sRegisteredObjectEditors.erase(this);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* PdmUiObjectEditorHandle::getOrCreateWidget(QWidget* parent)
|
||||
{
|
||||
if (m_widget.isNull())
|
||||
{
|
||||
m_widget = this->createWidget(parent);
|
||||
}
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* PdmUiObjectEditorHandle::widget() const
|
||||
{
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -2,6 +2,7 @@
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) 2011-2013 Ceetron AS
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// This library may be used under the terms of either the GNU General Public License or
|
||||
// the GNU Lesser General Public License as follows:
|
||||
@ -41,10 +42,6 @@
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include <QPointer>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@ -60,9 +57,6 @@ class PdmUiObjectEditorHandle : public PdmUiEditorHandle
|
||||
public:
|
||||
PdmUiObjectEditorHandle();
|
||||
~PdmUiObjectEditorHandle() override;
|
||||
|
||||
QWidget* getOrCreateWidget(QWidget* parent);
|
||||
QWidget* widget() const;
|
||||
|
||||
void setPdmObject(PdmObjectHandle* object);
|
||||
PdmObjectHandle* pdmObject();
|
||||
@ -72,18 +66,12 @@ public:
|
||||
static void updateUiAllObjectEditors();
|
||||
|
||||
protected:
|
||||
/// Supposed to create the top level widget of the editor with a suitable QLayout
|
||||
virtual QWidget* createWidget(QWidget* parent) = 0;
|
||||
|
||||
virtual void cleanupBeforeSettingPdmObject() {};
|
||||
|
||||
private:
|
||||
QPointer<QWidget> m_widget;
|
||||
|
||||
static std::set<QPointer<PdmUiObjectEditorHandle>> m_sRegisteredObjectEditors;
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // End of namespace caf
|
||||
|
||||
|
@ -0,0 +1,80 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// This library may be used under the terms of either the GNU General Public License or
|
||||
// the GNU Lesser General Public License as follows:
|
||||
//
|
||||
// GNU General Public License Usage
|
||||
// This library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
|
||||
// for more details.
|
||||
//
|
||||
// GNU Lesser General Public License Usage
|
||||
// This library is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
|
||||
// for more details.
|
||||
//
|
||||
//##################################################################################################
|
||||
|
||||
#include "cafPdmUiWidgetObjectEditorHandle.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
PdmUiWidgetObjectEditorHandle::PdmUiWidgetObjectEditorHandle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
PdmUiWidgetObjectEditorHandle::~PdmUiWidgetObjectEditorHandle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* PdmUiWidgetObjectEditorHandle::getOrCreateWidget(QWidget* parent)
|
||||
{
|
||||
if (m_widget.isNull())
|
||||
{
|
||||
m_widget = this->createWidget(parent);
|
||||
}
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* PdmUiWidgetObjectEditorHandle::widget() const
|
||||
{
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
|
||||
} //End of namespace caf
|
||||
|
@ -0,0 +1,70 @@
|
||||
//##################################################################################################
|
||||
//
|
||||
// Custom Visualization Core library
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
// This library may be used under the terms of either the GNU General Public License or
|
||||
// the GNU Lesser General Public License as follows:
|
||||
//
|
||||
// GNU General Public License Usage
|
||||
// This library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <<http://www.gnu.org/licenses/gpl.html>>
|
||||
// for more details.
|
||||
//
|
||||
// GNU Lesser General Public License Usage
|
||||
// This library is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
|
||||
// for more details.
|
||||
//
|
||||
//##################################################################################################
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmUiObjectEditorHandle.h"
|
||||
|
||||
#include <QPointer>
|
||||
#include <QWidget>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
|
||||
//==================================================================================================
|
||||
/// Abstract class to handle widget based editors for complete PdmObjects
|
||||
//==================================================================================================
|
||||
|
||||
class PdmUiWidgetObjectEditorHandle : public PdmUiObjectEditorHandle
|
||||
{
|
||||
public:
|
||||
PdmUiWidgetObjectEditorHandle();
|
||||
~PdmUiWidgetObjectEditorHandle() override;
|
||||
|
||||
QWidget* getOrCreateWidget(QWidget* parent);
|
||||
QWidget* widget() const;
|
||||
|
||||
protected:
|
||||
/// Supposed to create the top level widget of the editor with a suitable QLayout
|
||||
virtual QWidget* createWidget(QWidget* parent) = 0;
|
||||
|
||||
private:
|
||||
QPointer<QWidget> m_widget;
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // End of namespace caf
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmUiObjectEditorHandle.h"
|
||||
#include "cafPdmUiWidgetObjectEditorHandle.h"
|
||||
#include "cafPdmUiOrdering.h"
|
||||
|
||||
#include <QPointer>
|
||||
@ -58,7 +58,7 @@ class PdmUiOrdering;
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class PdmUiFormLayoutObjectEditor : public PdmUiObjectEditorHandle
|
||||
class PdmUiFormLayoutObjectEditor : public PdmUiWidgetObjectEditorHandle
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -38,7 +38,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmUiFieldEditorHandle.h"
|
||||
#include "cafPdmUiObjectEditorHandle.h"
|
||||
#include "cafPdmUiWidgetObjectEditorHandle.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPointer>
|
||||
@ -103,7 +103,7 @@ private:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class PdmUiListViewEditor : public PdmUiObjectEditorHandle
|
||||
class PdmUiListViewEditor : public PdmUiWidgetObjectEditorHandle
|
||||
{
|
||||
public:
|
||||
PdmUiListViewEditor();
|
||||
|
@ -62,7 +62,7 @@ namespace caf
|
||||
{
|
||||
|
||||
class PdmObjectHandle;
|
||||
class PdmUiObjectEditorHandle;
|
||||
class PdmUiWidgetObjectEditorHandle;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -84,11 +84,11 @@ public slots:
|
||||
void showProperties(caf::PdmObjectHandle* object); // Signal/Slot system needs caf:: prefix in some cases
|
||||
|
||||
private:
|
||||
PdmUiObjectEditorHandle* m_currentObjectView;
|
||||
QString m_uiConfigName;
|
||||
PdmUiWidgetObjectEditorHandle* m_currentObjectView;
|
||||
QString m_uiConfigName;
|
||||
|
||||
QPointer<QVBoxLayout> m_placeHolderLayout;
|
||||
QPointer<QWidget> m_placeholder;
|
||||
QPointer<QVBoxLayout> m_placeHolderLayout;
|
||||
QPointer<QWidget> m_placeholder;
|
||||
};
|
||||
|
||||
|
||||
|
@ -39,7 +39,6 @@
|
||||
|
||||
#include "cafPdmDocument.h"
|
||||
#include "cafPdmUiFieldEditorHandle.h"
|
||||
#include "cafPdmUiObjectEditorHandle.h"
|
||||
#include "cafSelectionChangedReceiver.h"
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
|
Loading…
Reference in New Issue
Block a user