mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1883 AppFwk : Add WidgetBasedObjectEditor
This commit is contained in:
parent
d40a7f11c6
commit
cb7d0ada8e
@ -47,6 +47,7 @@ set( QOBJECT_HEADERS
|
|||||||
QMinimizePanel.h
|
QMinimizePanel.h
|
||||||
cafPdmUiTreeSelectionEditor.h
|
cafPdmUiTreeSelectionEditor.h
|
||||||
cafPdmUiTreeSelectionQModel.h
|
cafPdmUiTreeSelectionQModel.h
|
||||||
|
cafPdmUiWidgetBasedObjectEditor.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if ( (${CMAKE_VERSION} VERSION_LESS 2.8.6) OR (NOT CMAKE_AUTOMOC) )
|
if ( (${CMAKE_VERSION} VERSION_LESS 2.8.6) OR (NOT CMAKE_AUTOMOC) )
|
||||||
@ -125,6 +126,9 @@ set( PROJECT_FILES
|
|||||||
cafPdmUiPropertyView.h
|
cafPdmUiPropertyView.h
|
||||||
cafPdmUiPropertyViewDialog.cpp
|
cafPdmUiPropertyViewDialog.cpp
|
||||||
cafPdmUiPropertyViewDialog.h
|
cafPdmUiPropertyViewDialog.h
|
||||||
|
cafPdmUiWidgetBasedObjectEditor.cpp
|
||||||
|
cafPdmUiWidgetBasedObjectEditor.h
|
||||||
|
|
||||||
|
|
||||||
# div
|
# div
|
||||||
cafAboutDialog.cpp
|
cafAboutDialog.cpp
|
||||||
|
@ -37,22 +37,22 @@
|
|||||||
|
|
||||||
#include "cafPdmUiDefaultObjectEditor.h"
|
#include "cafPdmUiDefaultObjectEditor.h"
|
||||||
|
|
||||||
#include "cafPdmField.h"
|
|
||||||
#include "cafPdmObject.h"
|
|
||||||
#include "cafPdmProxyValueField.h"
|
#include "cafPdmProxyValueField.h"
|
||||||
#include "cafPdmUiCheckBoxEditor.h"
|
#include "cafPdmUiCheckBoxEditor.h"
|
||||||
#include "cafPdmUiComboBoxEditor.h"
|
#include "cafPdmUiComboBoxEditor.h"
|
||||||
|
#include "cafPdmUiDateEditor.h"
|
||||||
#include "cafPdmUiFieldEditorHandle.h"
|
#include "cafPdmUiFieldEditorHandle.h"
|
||||||
|
#include "cafPdmUiFieldHandle.h"
|
||||||
|
#include "cafPdmUiGroup.h"
|
||||||
#include "cafPdmUiLineEditor.h"
|
#include "cafPdmUiLineEditor.h"
|
||||||
#include "cafPdmUiListEditor.h"
|
#include "cafPdmUiListEditor.h"
|
||||||
#include "cafPdmUiOrdering.h"
|
|
||||||
#include "cafPdmUiDateEditor.h"
|
|
||||||
|
|
||||||
#include <QGridLayout>
|
#include "QMinimizePanel.h"
|
||||||
#include <QWidget>
|
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
@ -87,9 +87,6 @@ PdmUiDefaultObjectEditor::PdmUiDefaultObjectEditor()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
PdmUiDefaultObjectEditor::~PdmUiDefaultObjectEditor()
|
PdmUiDefaultObjectEditor::~PdmUiDefaultObjectEditor()
|
||||||
{
|
{
|
||||||
// If there are field editor present, the usage of this editor has not cleared correctly
|
|
||||||
// The intended usage is to call the method setPdmObject(NULL) before closing the dialog
|
|
||||||
CAF_ASSERT(m_fieldViews.size() == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -97,108 +94,21 @@ PdmUiDefaultObjectEditor::~PdmUiDefaultObjectEditor()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QWidget* PdmUiDefaultObjectEditor::createWidget(QWidget* parent)
|
QWidget* PdmUiDefaultObjectEditor::createWidget(QWidget* parent)
|
||||||
{
|
{
|
||||||
m_mainWidget = new QWidget(parent);
|
QWidget* widget = PdmUiWidgetBasedObjectEditor::createWidget(parent);
|
||||||
m_layout = new QGridLayout();
|
|
||||||
|
m_layout = new QGridLayout();
|
||||||
m_layout->setContentsMargins(0, 0, 0, 0);
|
m_layout->setContentsMargins(0, 0, 0, 0);
|
||||||
m_mainWidget->setLayout(m_layout);
|
widget->setLayout(m_layout);
|
||||||
|
|
||||||
return m_mainWidget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void PdmUiDefaultObjectEditor::configureAndUpdateUi(const QString& uiConfigName)
|
void PdmUiDefaultObjectEditor::setupFieldsAndGroups(const std::vector<PdmUiItem *>& uiItems, QWidget* parent, const QString& uiConfigName)
|
||||||
{
|
{
|
||||||
PdmUiOrdering config;
|
recursiveSetupFieldsAndGroups(uiItems, parent, m_layout, uiConfigName);
|
||||||
if (pdmObject())
|
|
||||||
{
|
|
||||||
caf::PdmUiObjectHandle* uiObject = uiObj(pdmObject());
|
|
||||||
if (uiObject)
|
|
||||||
{
|
|
||||||
uiObject->uiOrdering(uiConfigName, config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set all fieldViews to be unvisited
|
|
||||||
std::map<PdmFieldHandle*, PdmUiFieldEditorHandle*>::iterator it;
|
|
||||||
for (it = m_fieldViews.begin(); it != m_fieldViews.end(); ++it)
|
|
||||||
{
|
|
||||||
it->second->setField(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set all group Boxes to be unvisited
|
|
||||||
m_newGroupBoxes.clear();
|
|
||||||
|
|
||||||
const std::vector<PdmUiItem*>& uiItems = config.uiItems();
|
|
||||||
|
|
||||||
// TODO: Review that is it not breaking anything to have fields with identical keywords
|
|
||||||
// {
|
|
||||||
// std::set<QString> fieldKeywordNames;
|
|
||||||
// std::set<QString> groupNames;
|
|
||||||
//
|
|
||||||
// recursiveVerifyUniqueNames(uiItems, uiConfigName, &fieldKeywordNames, &groupNames);
|
|
||||||
// }
|
|
||||||
|
|
||||||
recursiveSetupFieldsAndGroups(uiItems, m_mainWidget, m_layout, uiConfigName);
|
|
||||||
|
|
||||||
// Remove all fieldViews not mentioned by the configuration from the layout
|
|
||||||
|
|
||||||
std::vector< PdmFieldHandle* > fvhToRemoveFromMap;
|
|
||||||
for (it = m_fieldViews.begin(); it != m_fieldViews.end(); ++it)
|
|
||||||
{
|
|
||||||
if (it->second->field() == 0)
|
|
||||||
{
|
|
||||||
PdmUiFieldEditorHandle* fvh = it->second;
|
|
||||||
delete fvh;
|
|
||||||
fvhToRemoveFromMap.push_back(it->first);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < fvhToRemoveFromMap.size(); ++i)
|
|
||||||
{
|
|
||||||
m_fieldViews.erase(fvhToRemoveFromMap[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove all unmentioned group boxes
|
|
||||||
|
|
||||||
std::map<QString, QPointer<QMinimizePanel> >::iterator itOld;
|
|
||||||
std::map<QString, QPointer<QMinimizePanel> >::iterator itNew;
|
|
||||||
|
|
||||||
for (itOld = m_groupBoxes.begin(); itOld != m_groupBoxes.end(); ++itOld )
|
|
||||||
{
|
|
||||||
itNew = m_newGroupBoxes.find(itOld->first);
|
|
||||||
if (itNew == m_newGroupBoxes.end())
|
|
||||||
{
|
|
||||||
// The old groupBox is not present anymore, get rid of it
|
|
||||||
if (!itOld->second.isNull()) delete itOld->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_groupBoxes = m_newGroupBoxes;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void PdmUiDefaultObjectEditor::cleanupBeforeSettingPdmObject()
|
|
||||||
{
|
|
||||||
std::map<PdmFieldHandle*, PdmUiFieldEditorHandle*>::iterator it;
|
|
||||||
for (it = m_fieldViews.begin(); it != m_fieldViews.end(); ++it)
|
|
||||||
{
|
|
||||||
PdmUiFieldEditorHandle* fvh = it->second;
|
|
||||||
delete fvh;
|
|
||||||
}
|
|
||||||
m_fieldViews.clear();
|
|
||||||
|
|
||||||
m_newGroupBoxes.clear();
|
|
||||||
|
|
||||||
std::map<QString, QPointer<QMinimizePanel> >::iterator groupIt;
|
|
||||||
for (groupIt = m_groupBoxes.begin(); groupIt != m_groupBoxes.end(); ++groupIt)
|
|
||||||
{
|
|
||||||
if (!groupIt->second.isNull()) groupIt->second->deleteLater();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_groupBoxes.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -216,88 +126,24 @@ void PdmUiDefaultObjectEditor::recursiveSetupFieldsAndGroups(const std::vector<P
|
|||||||
if (uiItems[i]->isUiGroup())
|
if (uiItems[i]->isUiGroup())
|
||||||
{
|
{
|
||||||
PdmUiGroup* group = static_cast<PdmUiGroup*>(uiItems[i]);
|
PdmUiGroup* group = static_cast<PdmUiGroup*>(uiItems[i]);
|
||||||
const std::vector<PdmUiItem*>& groupChildren = group->uiItems();
|
|
||||||
|
QMinimizePanel* groupBox = findOrCreateGroupBox(group, parent, uiConfigName);
|
||||||
QString groupBoxKey = group->keyword();
|
|
||||||
QMinimizePanel* groupBox = NULL;
|
|
||||||
QGridLayout* groupBoxLayout = NULL;
|
|
||||||
|
|
||||||
// Find or create groupBox
|
|
||||||
std::map<QString, QPointer<QMinimizePanel> >::iterator it;
|
|
||||||
it = m_groupBoxes.find(groupBoxKey);
|
|
||||||
|
|
||||||
if (it == m_groupBoxes.end())
|
|
||||||
{
|
|
||||||
groupBox = new QMinimizePanel( parent );
|
|
||||||
groupBox->setTitle(group->uiName(uiConfigName));
|
|
||||||
groupBox->setObjectName(group->keyword());
|
|
||||||
groupBoxLayout = new QGridLayout();
|
|
||||||
groupBox->contentFrame()->setLayout(groupBoxLayout);
|
|
||||||
connect(groupBox, SIGNAL(expandedChanged(bool)), this, SLOT(groupBoxExpandedStateToggled(bool)));
|
|
||||||
|
|
||||||
m_newGroupBoxes[groupBoxKey] = groupBox;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
groupBox = it->second;
|
|
||||||
CAF_ASSERT(groupBox);
|
|
||||||
|
|
||||||
groupBoxLayout = dynamic_cast<QGridLayout*>(groupBox->contentFrame()->layout());
|
|
||||||
CAF_ASSERT(groupBoxLayout);
|
|
||||||
|
|
||||||
m_newGroupBoxes[groupBoxKey] = groupBox;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Insert the group box at the correct position of the parent layout
|
/// Insert the group box at the correct position of the parent layout
|
||||||
|
|
||||||
parentLayout->addWidget(groupBox, currentRowIndex, 0, 1, 2);
|
parentLayout->addWidget(groupBox, currentRowIndex, 0, 1, 2);
|
||||||
|
|
||||||
// Set Expanded state
|
QGridLayout* groupBoxLayout = this->groupBoxLayout(groupBox);
|
||||||
bool isExpanded = isUiGroupExpanded(group);
|
|
||||||
groupBox->setExpanded(isExpanded);
|
|
||||||
|
|
||||||
// Update the title to be able to support dynamic group names
|
|
||||||
groupBox->setTitle(group->uiName(uiConfigName));
|
|
||||||
|
|
||||||
|
const std::vector<PdmUiItem*>& groupChildren = group->uiItems();
|
||||||
recursiveSetupFieldsAndGroups(groupChildren, groupBox->contentFrame(), groupBoxLayout, uiConfigName);
|
recursiveSetupFieldsAndGroups(groupChildren, groupBox->contentFrame(), groupBoxLayout, uiConfigName);
|
||||||
|
|
||||||
currentRowIndex++;
|
currentRowIndex++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PdmUiFieldHandle* field = dynamic_cast<PdmUiFieldHandle*>(uiItems[i]);
|
PdmUiFieldHandle* field = dynamic_cast<PdmUiFieldHandle*>(uiItems[i]);
|
||||||
PdmUiFieldEditorHandle* fieldEditor = NULL;
|
|
||||||
|
|
||||||
// Find or create FieldEditor
|
PdmUiFieldEditorHandle* fieldEditor = findOrCreateFieldEditor(parent, field, uiConfigName);
|
||||||
std::map<PdmFieldHandle*, PdmUiFieldEditorHandle*>::iterator it;
|
|
||||||
it = m_fieldViews.find(field->fieldHandle());
|
|
||||||
|
|
||||||
if (it == m_fieldViews.end())
|
|
||||||
{
|
|
||||||
fieldEditor = PdmUiFieldEditorHelper::fieldEditorForField(field, uiConfigName);
|
|
||||||
|
|
||||||
if (fieldEditor)
|
|
||||||
{
|
|
||||||
m_fieldViews[field->fieldHandle()] = fieldEditor;
|
|
||||||
fieldEditor->createWidgets(parent);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// This assert happens if no editor is available for a given field
|
|
||||||
// If the macro for registering the editor is put as the single statement
|
|
||||||
// in a cpp file, a dummy static class must be used to make sure the compile unit
|
|
||||||
// is included
|
|
||||||
//
|
|
||||||
// See cafPdmUiCoreColor3f and cafPdmUiCoreVec3d
|
|
||||||
|
|
||||||
// This assert will trigger for PdmChildArrayField and PdmChildField
|
|
||||||
// Consider to exclude assert or add editors for these types if the assert is reintroduced
|
|
||||||
//CAF_ASSERT(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fieldEditor = it->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fieldEditor)
|
if (fieldEditor)
|
||||||
{
|
{
|
||||||
@ -313,7 +159,6 @@ void PdmUiDefaultObjectEditor::recursiveSetupFieldsAndGroups(const std::vector<P
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
PdmUiItemInfo::LabelPosType labelPos = field->uiLabelPosition(uiConfigName);
|
PdmUiItemInfo::LabelPosType labelPos = field->uiLabelPosition(uiConfigName);
|
||||||
bool labelOnTop = (labelPos == PdmUiItemInfo::TOP);
|
bool labelOnTop = (labelPos == PdmUiItemInfo::TOP);
|
||||||
bool editorSpanBoth = labelOnTop;
|
bool editorSpanBoth = labelOnTop;
|
||||||
@ -347,7 +192,6 @@ void PdmUiDefaultObjectEditor::recursiveSetupFieldsAndGroups(const std::vector<P
|
|||||||
editorSpanBoth = true; // To span both columns when there is no label
|
editorSpanBoth = true; // To span both columns when there is no label
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (fieldEditorWidget)
|
if (fieldEditorWidget)
|
||||||
{
|
{
|
||||||
fieldEditorWidget->setParent(parent); // To make sure this widget has the current group box as parent.
|
fieldEditorWidget->setParent(parent); // To make sure this widget has the current group box as parent.
|
||||||
@ -361,80 +205,12 @@ void PdmUiDefaultObjectEditor::recursiveSetupFieldsAndGroups(const std::vector<P
|
|||||||
|
|
||||||
previousTabOrderWidget = fieldEditorWidget;
|
previousTabOrderWidget = fieldEditorWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldEditor->updateUi(uiConfigName);
|
fieldEditor->updateUi(uiConfigName);
|
||||||
|
|
||||||
currentRowIndex++;
|
currentRowIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool PdmUiDefaultObjectEditor::isUiGroupExpanded(const PdmUiGroup* uiGroup)
|
|
||||||
{
|
|
||||||
if (uiGroup->hasForcedExpandedState()) return uiGroup->forcedExpandedState();
|
|
||||||
|
|
||||||
auto kwMapPair = m_objectKeywordGroupUiNameExpandedState.find(pdmObject()->xmlCapability()->classKeyword());
|
|
||||||
if ( kwMapPair != m_objectKeywordGroupUiNameExpandedState.end() )
|
|
||||||
{
|
|
||||||
QString keyword = uiGroup->keyword();
|
|
||||||
|
|
||||||
auto uiNameExpStatePair = kwMapPair->second.find(keyword);
|
|
||||||
if ( uiNameExpStatePair != kwMapPair->second.end() )
|
|
||||||
{
|
|
||||||
return uiNameExpStatePair->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return uiGroup->isExpandedByDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void PdmUiDefaultObjectEditor::recursiveVerifyUniqueNames(const std::vector<PdmUiItem*>& uiItems, const QString& uiConfigName, std::set<QString>* fieldKeywordNames, std::set<QString>* groupNames)
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < uiItems.size(); ++i)
|
|
||||||
{
|
|
||||||
if (uiItems[i]->isUiGroup())
|
|
||||||
{
|
|
||||||
PdmUiGroup* group = static_cast<PdmUiGroup*>(uiItems[i]);
|
|
||||||
const std::vector<PdmUiItem*>& groupChildren = group->uiItems();
|
|
||||||
|
|
||||||
QString groupBoxKey = group->keyword();
|
|
||||||
|
|
||||||
if (groupNames->find(groupBoxKey) != groupNames->end())
|
|
||||||
{
|
|
||||||
// It is not supported to have two groups with identical names
|
|
||||||
CAF_ASSERT(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
groupNames->insert(groupBoxKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
recursiveVerifyUniqueNames(groupChildren, uiConfigName, fieldKeywordNames, groupNames);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PdmUiFieldHandle* field = dynamic_cast<PdmUiFieldHandle*>(uiItems[i]);
|
|
||||||
|
|
||||||
QString fieldKeyword = field->fieldHandle()->keyword();
|
|
||||||
if (fieldKeywordNames->find(fieldKeyword) != fieldKeywordNames->end())
|
|
||||||
{
|
|
||||||
// It is not supported to have two fields with identical names
|
|
||||||
CAF_ASSERT(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fieldKeywordNames->insert(fieldKeyword);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -484,20 +260,5 @@ caf::PdmUiFieldEditorHandle* PdmUiFieldEditorHelper::fieldEditorForField(PdmUiFi
|
|||||||
return fieldEditor;
|
return fieldEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void PdmUiDefaultObjectEditor::groupBoxExpandedStateToggled(bool isExpanded)
|
|
||||||
{
|
|
||||||
if (!this->pdmObject()->xmlCapability()) return;
|
|
||||||
|
|
||||||
QString objKeyword = this->pdmObject()->xmlCapability()->classKeyword();
|
|
||||||
QMinimizePanel* panel = dynamic_cast<QMinimizePanel*>(this->sender());
|
|
||||||
|
|
||||||
if (!panel) return;
|
|
||||||
|
|
||||||
m_objectKeywordGroupUiNameExpandedState[objKeyword][panel->objectName()] = isExpanded;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end namespace caf
|
} // end namespace caf
|
||||||
|
@ -37,15 +37,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cafPdmUiObjectEditorHandle.h"
|
#include "cafPdmUiWidgetBasedObjectEditor.h"
|
||||||
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
#include <QGroupBox>
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QWidget>
|
|
||||||
#include "QMinimizePanel.h"
|
|
||||||
|
|
||||||
class QGridLayout;
|
class QGridLayout;
|
||||||
|
|
||||||
@ -66,37 +61,21 @@ public:
|
|||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
/// The default editor for PdmObjects. Manages the field editors in a gridlayout vertically
|
/// The default editor for PdmObjects. Manages the field editors in a gridlayout vertically
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
class PdmUiDefaultObjectEditor : public PdmUiWidgetBasedObjectEditor
|
||||||
class PdmUiDefaultObjectEditor : public PdmUiObjectEditorHandle
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PdmUiDefaultObjectEditor();
|
PdmUiDefaultObjectEditor();
|
||||||
~PdmUiDefaultObjectEditor();
|
~PdmUiDefaultObjectEditor();
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
virtual QWidget* createWidget(QWidget* parent) override;
|
virtual QWidget* createWidget(QWidget* parent) override;
|
||||||
virtual void configureAndUpdateUi(const QString& uiConfigName) override;
|
virtual void setupFieldsAndGroups(const std::vector<PdmUiItem *>& uiItems, QWidget* parent, const QString& uiConfigName) override;
|
||||||
virtual void cleanupBeforeSettingPdmObject() override;
|
void recursiveSetupFieldsAndGroups(const std::vector<PdmUiItem*>& uiItems, QWidget* parent, QGridLayout* parentLayout, const QString& uiConfigName);
|
||||||
|
|
||||||
protected slots:
|
|
||||||
void groupBoxExpandedStateToggled(bool isExpanded);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void recursiveSetupFieldsAndGroups(const std::vector<PdmUiItem*>& uiItems, QWidget* parent, QGridLayout* parentLayout, const QString& uiConfigName);
|
QPointer<QGridLayout> m_layout;
|
||||||
bool isUiGroupExpanded(const PdmUiGroup* uiGroup);
|
|
||||||
void recursiveVerifyUniqueNames(const std::vector<PdmUiItem*>& uiItems, const QString& uiConfigName, std::set<QString>* fieldKeywordNames, std::set<QString>* groupNames);
|
|
||||||
|
|
||||||
std::map<PdmFieldHandle*, PdmUiFieldEditorHandle*> m_fieldViews;
|
|
||||||
std::map<QString, QPointer<QMinimizePanel> > m_groupBoxes;
|
|
||||||
std::map<QString, QPointer<QMinimizePanel> > m_newGroupBoxes; ///< used temporarily to store the new(complete) set of group boxes
|
|
||||||
|
|
||||||
QPointer<QWidget> m_mainWidget;
|
|
||||||
QPointer<QGridLayout> m_layout;
|
|
||||||
|
|
||||||
std::map<QString, std::map<QString, bool> > m_objectKeywordGroupUiNameExpandedState;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // end namespace caf
|
} // end namespace caf
|
||||||
|
348
Fwk/AppFwk/cafUserInterface/cafPdmUiWidgetBasedObjectEditor.cpp
Normal file
348
Fwk/AppFwk/cafUserInterface/cafPdmUiWidgetBasedObjectEditor.cpp
Normal file
@ -0,0 +1,348 @@
|
|||||||
|
//##################################################################################################
|
||||||
|
//
|
||||||
|
// Custom Visualization Core library
|
||||||
|
// Copyright (C) 2017 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 "cafPdmUiWidgetBasedObjectEditor.h"
|
||||||
|
|
||||||
|
#include "cafPdmObjectHandle.h"
|
||||||
|
#include "cafPdmUiFieldEditorHandle.h"
|
||||||
|
#include "cafPdmUiObjectHandle.h"
|
||||||
|
#include "cafPdmUiOrdering.h"
|
||||||
|
#include "cafPdmXmlObjectHandle.h"
|
||||||
|
|
||||||
|
#include "QMinimizePanel.h"
|
||||||
|
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QFrame>
|
||||||
|
#include "cafPdmUiFieldHandle.h"
|
||||||
|
#include "cafPdmUiDefaultObjectEditor.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
caf::PdmUiWidgetBasedObjectEditor::PdmUiWidgetBasedObjectEditor()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
caf::PdmUiWidgetBasedObjectEditor::~PdmUiWidgetBasedObjectEditor()
|
||||||
|
{
|
||||||
|
// If there are field editor present, the usage of this editor has not cleared correctly
|
||||||
|
// The intended usage is to call the method setPdmObject(NULL) before closing the dialog
|
||||||
|
CAF_ASSERT(m_fieldViews.size() == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QWidget* caf::PdmUiWidgetBasedObjectEditor::createWidget(QWidget* parent)
|
||||||
|
{
|
||||||
|
m_mainWidget = new QWidget(parent);
|
||||||
|
|
||||||
|
return m_mainWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool caf::PdmUiWidgetBasedObjectEditor::isUiGroupExpanded(const PdmUiGroup* uiGroup) const
|
||||||
|
{
|
||||||
|
if (uiGroup->hasForcedExpandedState()) return uiGroup->forcedExpandedState();
|
||||||
|
|
||||||
|
auto kwMapPair = m_objectKeywordGroupUiNameExpandedState.find(pdmObject()->xmlCapability()->classKeyword());
|
||||||
|
if (kwMapPair != m_objectKeywordGroupUiNameExpandedState.end())
|
||||||
|
{
|
||||||
|
QString keyword = uiGroup->keyword();
|
||||||
|
|
||||||
|
auto uiNameExpStatePair = kwMapPair->second.find(keyword);
|
||||||
|
if (uiNameExpStatePair != kwMapPair->second.end())
|
||||||
|
{
|
||||||
|
return uiNameExpStatePair->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return uiGroup->isExpandedByDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QMinimizePanel* caf::PdmUiWidgetBasedObjectEditor::findOrCreateGroupBox(PdmUiGroup* group, QWidget* parent, const QString& uiConfigName)
|
||||||
|
{
|
||||||
|
QString groupBoxKey = group->keyword();
|
||||||
|
QMinimizePanel* groupBox = NULL;
|
||||||
|
QGridLayout* groupBoxLayout = NULL;
|
||||||
|
|
||||||
|
// Find or create groupBox
|
||||||
|
std::map<QString, QPointer<QMinimizePanel> >::iterator it;
|
||||||
|
it = m_groupBoxes.find(groupBoxKey);
|
||||||
|
|
||||||
|
if (it == m_groupBoxes.end())
|
||||||
|
{
|
||||||
|
groupBox = new QMinimizePanel(parent);
|
||||||
|
groupBox->setTitle(group->uiName(uiConfigName));
|
||||||
|
groupBox->setObjectName(group->keyword());
|
||||||
|
groupBoxLayout = new QGridLayout();
|
||||||
|
groupBox->contentFrame()->setLayout(groupBoxLayout);
|
||||||
|
connect(groupBox, SIGNAL(expandedChanged(bool)), this, SLOT(groupBoxExpandedStateToggled(bool)));
|
||||||
|
|
||||||
|
m_newGroupBoxes[groupBoxKey] = groupBox;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
groupBox = it->second;
|
||||||
|
CAF_ASSERT(groupBox);
|
||||||
|
|
||||||
|
m_newGroupBoxes[groupBoxKey] = groupBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set Expanded state
|
||||||
|
bool isExpanded = isUiGroupExpanded(group);
|
||||||
|
groupBox->setExpanded(isExpanded);
|
||||||
|
|
||||||
|
// Update the title to be able to support dynamic group names
|
||||||
|
groupBox->setTitle(group->uiName(uiConfigName));
|
||||||
|
|
||||||
|
return groupBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QGridLayout* caf::PdmUiWidgetBasedObjectEditor::groupBoxLayout(QMinimizePanel* groupBox)
|
||||||
|
{
|
||||||
|
return dynamic_cast<QGridLayout*>(groupBox->contentFrame()->layout());
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
caf::PdmUiFieldEditorHandle* caf::PdmUiWidgetBasedObjectEditor::findOrCreateFieldEditor(QWidget* parent, PdmUiFieldHandle* field, const QString& uiConfigName)
|
||||||
|
{
|
||||||
|
caf::PdmUiFieldEditorHandle* fieldEditor = nullptr;
|
||||||
|
|
||||||
|
std::map<PdmFieldHandle*, PdmUiFieldEditorHandle*>::iterator it = m_fieldViews.find(field->fieldHandle());
|
||||||
|
|
||||||
|
if (it == m_fieldViews.end())
|
||||||
|
{
|
||||||
|
fieldEditor = PdmUiFieldEditorHelper::fieldEditorForField(field, uiConfigName);
|
||||||
|
|
||||||
|
if (fieldEditor)
|
||||||
|
{
|
||||||
|
m_fieldViews[field->fieldHandle()] = fieldEditor;
|
||||||
|
fieldEditor->createWidgets(parent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This assert happens if no editor is available for a given field
|
||||||
|
// If the macro for registering the editor is put as the single statement
|
||||||
|
// in a cpp file, a dummy static class must be used to make sure the compile unit
|
||||||
|
// is included
|
||||||
|
//
|
||||||
|
// See cafPdmUiCoreColor3f and cafPdmUiCoreVec3d
|
||||||
|
|
||||||
|
// This assert will trigger for PdmChildArrayField and PdmChildField
|
||||||
|
// Consider to exclude assert or add editors for these types if the assert is reintroduced
|
||||||
|
//CAF_ASSERT(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fieldEditor = it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fieldEditor;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void caf::PdmUiWidgetBasedObjectEditor::groupBoxExpandedStateToggled(bool isExpanded)
|
||||||
|
{
|
||||||
|
if (!this->pdmObject()->xmlCapability()) return;
|
||||||
|
|
||||||
|
QString objKeyword = this->pdmObject()->xmlCapability()->classKeyword();
|
||||||
|
QMinimizePanel* panel = dynamic_cast<QMinimizePanel*>(this->sender());
|
||||||
|
|
||||||
|
if (!panel) return;
|
||||||
|
|
||||||
|
m_objectKeywordGroupUiNameExpandedState[objKeyword][panel->objectName()] = isExpanded;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void caf::PdmUiWidgetBasedObjectEditor::cleanupBeforeSettingPdmObject()
|
||||||
|
{
|
||||||
|
std::map<PdmFieldHandle*, PdmUiFieldEditorHandle*>::iterator it;
|
||||||
|
for (it = m_fieldViews.begin(); it != m_fieldViews.end(); ++it)
|
||||||
|
{
|
||||||
|
PdmUiFieldEditorHandle* fvh = it->second;
|
||||||
|
delete fvh;
|
||||||
|
}
|
||||||
|
m_fieldViews.clear();
|
||||||
|
|
||||||
|
m_newGroupBoxes.clear();
|
||||||
|
|
||||||
|
std::map<QString, QPointer<QMinimizePanel> >::iterator groupIt;
|
||||||
|
for (groupIt = m_groupBoxes.begin(); groupIt != m_groupBoxes.end(); ++groupIt)
|
||||||
|
{
|
||||||
|
if (!groupIt->second.isNull()) groupIt->second->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_groupBoxes.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void caf::PdmUiWidgetBasedObjectEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||||
|
{
|
||||||
|
caf::PdmUiOrdering config;
|
||||||
|
if (pdmObject())
|
||||||
|
{
|
||||||
|
caf::PdmUiObjectHandle* uiObject = uiObj(pdmObject());
|
||||||
|
if (uiObject)
|
||||||
|
{
|
||||||
|
uiObject->uiOrdering(uiConfigName, config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set all fieldViews to be unvisited
|
||||||
|
std::map<PdmFieldHandle*, PdmUiFieldEditorHandle*>::iterator it;
|
||||||
|
for (it = m_fieldViews.begin(); it != m_fieldViews.end(); ++it)
|
||||||
|
{
|
||||||
|
it->second->setField(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set all group Boxes to be unvisited
|
||||||
|
m_newGroupBoxes.clear();
|
||||||
|
|
||||||
|
const std::vector<PdmUiItem*>& uiItems = config.uiItems();
|
||||||
|
|
||||||
|
// TODO: Review that is it not breaking anything to have fields with identical keywords
|
||||||
|
// {
|
||||||
|
// std::set<QString> fieldKeywordNames;
|
||||||
|
// std::set<QString> groupNames;
|
||||||
|
//
|
||||||
|
// recursiveVerifyUniqueNames(uiItems, uiConfigName, &fieldKeywordNames, &groupNames);
|
||||||
|
// }
|
||||||
|
|
||||||
|
//recursiveSetupFieldsAndGroups(uiItems, m_mainWidget, m_layout, uiConfigName);
|
||||||
|
setupFieldsAndGroups(uiItems, m_mainWidget, uiConfigName);
|
||||||
|
|
||||||
|
// Remove all fieldViews not mentioned by the configuration from the layout
|
||||||
|
|
||||||
|
std::vector< PdmFieldHandle* > fvhToRemoveFromMap;
|
||||||
|
for (it = m_fieldViews.begin(); it != m_fieldViews.end(); ++it)
|
||||||
|
{
|
||||||
|
if (it->second->field() == 0)
|
||||||
|
{
|
||||||
|
PdmUiFieldEditorHandle* fvh = it->second;
|
||||||
|
delete fvh;
|
||||||
|
fvhToRemoveFromMap.push_back(it->first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < fvhToRemoveFromMap.size(); ++i)
|
||||||
|
{
|
||||||
|
m_fieldViews.erase(fvhToRemoveFromMap[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove all unmentioned group boxes
|
||||||
|
|
||||||
|
std::map<QString, QPointer<QMinimizePanel> >::iterator itOld;
|
||||||
|
std::map<QString, QPointer<QMinimizePanel> >::iterator itNew;
|
||||||
|
|
||||||
|
for (itOld = m_groupBoxes.begin(); itOld != m_groupBoxes.end(); ++itOld)
|
||||||
|
{
|
||||||
|
itNew = m_newGroupBoxes.find(itOld->first);
|
||||||
|
if (itNew == m_newGroupBoxes.end())
|
||||||
|
{
|
||||||
|
// The old groupBox is not present anymore, get rid of it
|
||||||
|
if (!itOld->second.isNull()) delete itOld->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_groupBoxes = m_newGroupBoxes;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void caf::PdmUiWidgetBasedObjectEditor::recursiveVerifyUniqueNames(const std::vector<PdmUiItem*>& uiItems, const QString& uiConfigName, std::set<QString>* fieldKeywordNames, std::set<QString>* groupNames)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < uiItems.size(); ++i)
|
||||||
|
{
|
||||||
|
if (uiItems[i]->isUiGroup())
|
||||||
|
{
|
||||||
|
PdmUiGroup* group = static_cast<PdmUiGroup*>(uiItems[i]);
|
||||||
|
const std::vector<PdmUiItem*>& groupChildren = group->uiItems();
|
||||||
|
|
||||||
|
QString groupBoxKey = group->keyword();
|
||||||
|
|
||||||
|
if (groupNames->find(groupBoxKey) != groupNames->end())
|
||||||
|
{
|
||||||
|
// It is not supported to have two groups with identical names
|
||||||
|
CAF_ASSERT(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
groupNames->insert(groupBoxKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
recursiveVerifyUniqueNames(groupChildren, uiConfigName, fieldKeywordNames, groupNames);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PdmUiFieldHandle* field = dynamic_cast<PdmUiFieldHandle*>(uiItems[i]);
|
||||||
|
|
||||||
|
QString fieldKeyword = field->fieldHandle()->keyword();
|
||||||
|
if (fieldKeywordNames->find(fieldKeyword) != fieldKeywordNames->end())
|
||||||
|
{
|
||||||
|
// It is not supported to have two fields with identical names
|
||||||
|
CAF_ASSERT(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fieldKeywordNames->insert(fieldKeyword);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,96 @@
|
|||||||
|
//##################################################################################################
|
||||||
|
//
|
||||||
|
// Custom Visualization Core library
|
||||||
|
// Copyright (C) 2017 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 <QString>
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
class QMinimizePanel;
|
||||||
|
class QGridLayout;
|
||||||
|
|
||||||
|
namespace caf {
|
||||||
|
|
||||||
|
class PdmUiFieldEditorHandle;
|
||||||
|
class PdmUiGroup;
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class PdmUiWidgetBasedObjectEditor : public PdmUiObjectEditorHandle
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
PdmUiWidgetBasedObjectEditor();
|
||||||
|
~PdmUiWidgetBasedObjectEditor();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void setupFieldsAndGroups(const std::vector<PdmUiItem*>& uiItems, QWidget* parent, const QString& uiConfigName) = 0;
|
||||||
|
virtual QWidget* createWidget(QWidget* parent) override;
|
||||||
|
|
||||||
|
bool isUiGroupExpanded(const PdmUiGroup* uiGroup) const;
|
||||||
|
QMinimizePanel* findOrCreateGroupBox(PdmUiGroup* group, QWidget* parent, const QString& uiConfigName);
|
||||||
|
PdmUiFieldEditorHandle* findOrCreateFieldEditor(QWidget* parent, PdmUiFieldHandle* field, const QString& uiConfigName);
|
||||||
|
|
||||||
|
static QGridLayout* groupBoxLayout(QMinimizePanel* groupBox);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void groupBoxExpandedStateToggled(bool isExpanded);
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual void cleanupBeforeSettingPdmObject() override;
|
||||||
|
virtual void configureAndUpdateUi(const QString& uiConfigName) override;
|
||||||
|
|
||||||
|
static void recursiveVerifyUniqueNames(const std::vector<PdmUiItem*>& uiItems, const QString& uiConfigName, std::set<QString>* fieldKeywordNames, std::set<QString>* groupNames);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QPointer<QWidget> m_mainWidget;
|
||||||
|
|
||||||
|
std::map<PdmFieldHandle*, PdmUiFieldEditorHandle*> m_fieldViews;
|
||||||
|
std::map<QString, QPointer<QMinimizePanel> > m_groupBoxes;
|
||||||
|
std::map<QString, QPointer<QMinimizePanel> > m_newGroupBoxes; ///< used temporarily to store the new(complete) set of group boxes
|
||||||
|
std::map<QString, std::map<QString, bool> > m_objectKeywordGroupUiNameExpandedState;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // end namespace caf
|
Loading…
Reference in New Issue
Block a user