mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
caf: Rename of SelectionRole to SelectionLevel and
CURRENT to FIRST_LEVEL Replace use of SelectionLevel enum as argument with int
This commit is contained in:
@@ -33,7 +33,7 @@ CAF_CMD_SOURCE_INIT(RicDeleteOptionItemFeature, "RicDeleteOptionItemFeature");
|
|||||||
void RicDeleteOptionItemFeature::onActionTriggered(bool isChecked)
|
void RicDeleteOptionItemFeature::onActionTriggered(bool isChecked)
|
||||||
{
|
{
|
||||||
std::vector<RicCreateMultipleFracturesOptionItemUi*> optionItems;
|
std::vector<RicCreateMultipleFracturesOptionItemUi*> optionItems;
|
||||||
caf::SelectionManager::instance()->objectsByType(&optionItems, caf::SelectionManager::CURRENT);
|
caf::SelectionManager::instance()->objectsByType(&optionItems, caf::SelectionManager::FIRST_LEVEL);
|
||||||
|
|
||||||
if (!optionItems.empty())
|
if (!optionItems.empty())
|
||||||
{
|
{
|
||||||
@@ -64,7 +64,7 @@ void RicDeleteOptionItemFeature::setupActionLook(QAction* actionToSetup)
|
|||||||
bool RicDeleteOptionItemFeature::isCommandEnabled()
|
bool RicDeleteOptionItemFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
std::vector<RicCreateMultipleFracturesOptionItemUi*> optionItems;
|
std::vector<RicCreateMultipleFracturesOptionItemUi*> optionItems;
|
||||||
caf::SelectionManager::instance()->objectsByType(&optionItems, caf::SelectionManager::CURRENT);
|
caf::SelectionManager::instance()->objectsByType(&optionItems, caf::SelectionManager::FIRST_LEVEL);
|
||||||
|
|
||||||
return !optionItems.empty();
|
return !optionItems.empty();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ void RicNewOptionItemFeature::onActionTriggered(bool isChecked)
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::vector<RicCreateMultipleFracturesOptionItemUi*> optionItems;
|
std::vector<RicCreateMultipleFracturesOptionItemUi*> optionItems;
|
||||||
caf::SelectionManager::instance()->objectsByType(&optionItems, caf::SelectionManager::CURRENT);
|
caf::SelectionManager::instance()->objectsByType(&optionItems, caf::SelectionManager::FIRST_LEVEL);
|
||||||
if (!optionItems.empty())
|
if (!optionItems.empty())
|
||||||
{
|
{
|
||||||
selectedOptionItem = optionItems.front();
|
selectedOptionItem = optionItems.front();
|
||||||
@@ -64,7 +64,7 @@ void RicNewOptionItemFeature::onActionTriggered(bool isChecked)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<RiuCreateMultipleFractionsUi*> multipleFractions;
|
std::vector<RiuCreateMultipleFractionsUi*> multipleFractions;
|
||||||
caf::SelectionManager::instance()->objectsByType(&multipleFractions, caf::SelectionManager::CURRENT);
|
caf::SelectionManager::instance()->objectsByType(&multipleFractions, caf::SelectionManager::FIRST_LEVEL);
|
||||||
if (!multipleFractions.empty())
|
if (!multipleFractions.empty())
|
||||||
{
|
{
|
||||||
multipleFractionUi = multipleFractions[0];
|
multipleFractionUi = multipleFractions[0];
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ bool RicDeleteWellPathAttributeFeature::isCommandEnabled()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::vector<RimWellPathAttribute*> objects;
|
std::vector<RimWellPathAttribute*> objects;
|
||||||
caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::CURRENT);
|
caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::FIRST_LEVEL);
|
||||||
|
|
||||||
if ( objects.size() > 0 )
|
if ( objects.size() > 0 )
|
||||||
{
|
{
|
||||||
@@ -49,7 +49,7 @@ bool RicDeleteWellPathAttributeFeature::isCommandEnabled()
|
|||||||
void RicDeleteWellPathAttributeFeature::onActionTriggered(bool isChecked)
|
void RicDeleteWellPathAttributeFeature::onActionTriggered(bool isChecked)
|
||||||
{
|
{
|
||||||
std::vector<RimWellPathAttribute*> attributes;
|
std::vector<RimWellPathAttribute*> attributes;
|
||||||
caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::CURRENT);
|
caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::FIRST_LEVEL);
|
||||||
if (attributes.size() > 0)
|
if (attributes.size() > 0)
|
||||||
{
|
{
|
||||||
RimWellPathAttributeCollection* wellPathAttributeCollection = nullptr;
|
RimWellPathAttributeCollection* wellPathAttributeCollection = nullptr;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ CAF_CMD_SOURCE_INIT(RicDeleteWellPathTargetFeature, "RicDeleteWellPathTargetFeat
|
|||||||
bool RicDeleteWellPathTargetFeature::isCommandEnabled()
|
bool RicDeleteWellPathTargetFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
std::vector<RimWellPathTarget*> objects;
|
std::vector<RimWellPathTarget*> objects;
|
||||||
caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::CURRENT);
|
caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::FIRST_LEVEL);
|
||||||
|
|
||||||
if ( objects.size() > 0 )
|
if ( objects.size() > 0 )
|
||||||
{
|
{
|
||||||
@@ -47,7 +47,7 @@ bool RicDeleteWellPathTargetFeature::isCommandEnabled()
|
|||||||
void RicDeleteWellPathTargetFeature::onActionTriggered(bool isChecked)
|
void RicDeleteWellPathTargetFeature::onActionTriggered(bool isChecked)
|
||||||
{
|
{
|
||||||
std::vector<RimWellPathTarget*> targets;
|
std::vector<RimWellPathTarget*> targets;
|
||||||
caf::SelectionManager::instance()->objectsByType(&targets, caf::SelectionManager::CURRENT);
|
caf::SelectionManager::instance()->objectsByType(&targets, caf::SelectionManager::FIRST_LEVEL);
|
||||||
|
|
||||||
if (targets.size() > 0)
|
if (targets.size() > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ bool RicNewWellPathAttributeFeature::isCommandEnabled()
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::vector<RimWellPathAttribute*> objects;
|
std::vector<RimWellPathAttribute*> objects;
|
||||||
caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::CURRENT);
|
caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::FIRST_LEVEL);
|
||||||
|
|
||||||
if ( objects.size() > 0 )
|
if ( objects.size() > 0 )
|
||||||
{
|
{
|
||||||
@@ -58,7 +58,7 @@ bool RicNewWellPathAttributeFeature::isCommandEnabled()
|
|||||||
void RicNewWellPathAttributeFeature::onActionTriggered(bool isChecked)
|
void RicNewWellPathAttributeFeature::onActionTriggered(bool isChecked)
|
||||||
{
|
{
|
||||||
std::vector<RimWellPathAttribute*> attributes;
|
std::vector<RimWellPathAttribute*> attributes;
|
||||||
caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::CURRENT);
|
caf::SelectionManager::instance()->objectsByType(&attributes, caf::SelectionManager::FIRST_LEVEL);
|
||||||
if (attributes.size() > 0)
|
if (attributes.size() > 0)
|
||||||
{
|
{
|
||||||
RimWellPathAttributeCollection* attributeCollection = nullptr;
|
RimWellPathAttributeCollection* attributeCollection = nullptr;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ bool RicNewWellPathListTargetFeature::isCommandEnabled()
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::vector<RimWellPathTarget*> objects;
|
std::vector<RimWellPathTarget*> objects;
|
||||||
caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::CURRENT);
|
caf::SelectionManager::instance()->objectsByType(&objects, caf::SelectionManager::FIRST_LEVEL);
|
||||||
|
|
||||||
if ( objects.size() > 0 )
|
if ( objects.size() > 0 )
|
||||||
{
|
{
|
||||||
@@ -58,7 +58,7 @@ bool RicNewWellPathListTargetFeature::isCommandEnabled()
|
|||||||
void RicNewWellPathListTargetFeature::onActionTriggered(bool isChecked)
|
void RicNewWellPathListTargetFeature::onActionTriggered(bool isChecked)
|
||||||
{
|
{
|
||||||
std::vector<RimWellPathTarget*> targets;
|
std::vector<RimWellPathTarget*> targets;
|
||||||
caf::SelectionManager::instance()->objectsByType(&targets, caf::SelectionManager::CURRENT);
|
caf::SelectionManager::instance()->objectsByType(&targets, caf::SelectionManager::FIRST_LEVEL);
|
||||||
if (targets.size() > 0)
|
if (targets.size() > 0)
|
||||||
{
|
{
|
||||||
auto firstTarget = targets.front();
|
auto firstTarget = targets.front();
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ QString CmdSelectionChangeExec::name()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void CmdSelectionChangeExec::redo()
|
void CmdSelectionChangeExec::redo()
|
||||||
{
|
{
|
||||||
SelectionManager::instance()->setSelectionFromReferences(m_commandData->m_newSelection.v(), m_commandData->m_selectionRole.v());
|
SelectionManager::instance()->setSelectionFromReferences(m_commandData->m_newSelection.v(), m_commandData->m_selectionLevel.v());
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -65,7 +65,7 @@ void CmdSelectionChangeExec::redo()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void CmdSelectionChangeExec::undo()
|
void CmdSelectionChangeExec::undo()
|
||||||
{
|
{
|
||||||
SelectionManager::instance()->setSelectionFromReferences(m_commandData->m_previousSelection.v(), m_commandData->m_selectionRole.v());
|
SelectionManager::instance()->setSelectionFromReferences(m_commandData->m_previousSelection.v(), m_commandData->m_selectionLevel.v());
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ public:
|
|||||||
{
|
{
|
||||||
CAF_PDM_InitObject("CmdSelectionChangeExecData uiName", "", "CmdSelectionChangeExecData tooltip", "CmdSelectionChangeExecData whatsthis");
|
CAF_PDM_InitObject("CmdSelectionChangeExecData uiName", "", "CmdSelectionChangeExecData tooltip", "CmdSelectionChangeExecData whatsthis");
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_selectionRole, "selectionRole", "selectionRole", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_selectionLevel, "selectionLevel", "selectionLevel", "", "", "");
|
||||||
CAF_PDM_InitField(&m_previousSelection, "previousSelection", std::vector<QString>(), "previousSelection", "", "", "");
|
CAF_PDM_InitField(&m_previousSelection, "previousSelection", std::vector<QString>(), "previousSelection", "", "", "");
|
||||||
CAF_PDM_InitField(&m_newSelection, "newSelection", std::vector<QString>(), "newSelection", "", "", "");
|
CAF_PDM_InitField(&m_newSelection, "newSelection", std::vector<QString>(), "newSelection", "", "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
PdmField< int > m_selectionRole;
|
PdmField< int > m_selectionLevel;
|
||||||
PdmField< std::vector<QString> > m_previousSelection;
|
PdmField< std::vector<QString> > m_previousSelection;
|
||||||
PdmField< std::vector<QString> > m_newSelection;
|
PdmField< std::vector<QString> > m_newSelection;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,6 +40,8 @@
|
|||||||
#include "cafCmdExecCommandManager.h"
|
#include "cafCmdExecCommandManager.h"
|
||||||
#include "cafCmdSelectionChangeExec.h"
|
#include "cafCmdSelectionChangeExec.h"
|
||||||
|
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
@@ -47,9 +49,9 @@ namespace caf
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void CmdSelectionHelper::executeSelectionCommand(const std::vector<PdmObjectHandle*>& selection, SelectionManager::SelectionRole role)
|
void CmdSelectionHelper::executeSelectionCommand(const std::vector<PdmObjectHandle*>& selection, int selectionLevel)
|
||||||
{
|
{
|
||||||
CmdSelectionChangeExec* selectionChangeExec = createSelectionCommand(selection, role);
|
CmdSelectionChangeExec* selectionChangeExec = createSelectionCommand(selection, selectionLevel);
|
||||||
|
|
||||||
CmdExecCommandManager::instance()->processExecuteCommand(selectionChangeExec);
|
CmdExecCommandManager::instance()->processExecuteCommand(selectionChangeExec);
|
||||||
}
|
}
|
||||||
@@ -57,11 +59,11 @@ void CmdSelectionHelper::executeSelectionCommand(const std::vector<PdmObjectHand
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
CmdSelectionChangeExec* CmdSelectionHelper::createSelectionCommand(const std::vector<PdmObjectHandle*>& selection, SelectionManager::SelectionRole role)
|
CmdSelectionChangeExec* CmdSelectionHelper::createSelectionCommand(const std::vector<PdmObjectHandle*>& selection, int selectionLevel)
|
||||||
{
|
{
|
||||||
CmdSelectionChangeExec* selectionChangeExec = new CmdSelectionChangeExec(SelectionManager::instance()->notificationCenter());
|
CmdSelectionChangeExec* selectionChangeExec = new CmdSelectionChangeExec(SelectionManager::instance()->notificationCenter());
|
||||||
selectionChangeExec->commandData()->m_selectionRole.v() = role;
|
selectionChangeExec->commandData()->m_selectionLevel.v() = selectionLevel;
|
||||||
SelectionManager::instance()->selectionAsReferences(selectionChangeExec->commandData()->m_previousSelection.v(), role);
|
SelectionManager::instance()->selectionAsReferences(selectionChangeExec->commandData()->m_previousSelection.v(), selectionLevel);
|
||||||
|
|
||||||
for (size_t i = 0; i < selection.size(); i++)
|
for (size_t i = 0; i < selection.size(); i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,20 +37,18 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cafSelectionManager.h"
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
class CmdSelectionChangeExec;
|
class CmdSelectionChangeExec;
|
||||||
|
class PdmObjectHandle;
|
||||||
|
|
||||||
class CmdSelectionHelper
|
class CmdSelectionHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void executeSelectionCommand(const std::vector<PdmObjectHandle*>& selection, SelectionManager::SelectionRole role);
|
static void executeSelectionCommand(const std::vector<PdmObjectHandle*>& selection, int selectionLevel);
|
||||||
static CmdSelectionChangeExec* createSelectionCommand(const std::vector<PdmObjectHandle*>& selection, SelectionManager::SelectionRole role);
|
static CmdSelectionChangeExec* createSelectionCommand(const std::vector<PdmObjectHandle*>& selection, int selectionLevel);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace caf
|
|||||||
CmdExecuteCommand* CmdDeleteItemFeature::createExecuteCommand()
|
CmdExecuteCommand* CmdDeleteItemFeature::createExecuteCommand()
|
||||||
{
|
{
|
||||||
std::vector<PdmUiItem*> items;
|
std::vector<PdmUiItem*> items;
|
||||||
SelectionManager::instance()->selectedItems(items, SelectionManager::CURRENT);
|
SelectionManager::instance()->selectedItems(items, SelectionManager::FIRST_LEVEL);
|
||||||
|
|
||||||
caf::PdmChildArrayFieldHandle* childArrayFieldHandle = caf::SelectionManager::instance()->activeChildArrayFieldHandle();
|
caf::PdmChildArrayFieldHandle* childArrayFieldHandle = caf::SelectionManager::instance()->activeChildArrayFieldHandle();
|
||||||
if (!childArrayFieldHandle) return nullptr;
|
if (!childArrayFieldHandle) return nullptr;
|
||||||
@@ -106,7 +106,7 @@ CmdExecuteCommand* CmdDeleteItemFeature::createExecuteCommand()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool CmdDeleteItemFeature::isCommandEnabled()
|
bool CmdDeleteItemFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
caf::PdmObject* currentPdmObject = dynamic_cast<caf::PdmObject*>(caf::SelectionManager::instance()->selectedItem(caf::SelectionManager::CURRENT));
|
caf::PdmObject* currentPdmObject = dynamic_cast<caf::PdmObject*>(caf::SelectionManager::instance()->selectedItem(caf::SelectionManager::FIRST_LEVEL));
|
||||||
if (!currentPdmObject) return false;
|
if (!currentPdmObject) return false;
|
||||||
|
|
||||||
caf::PdmChildArrayFieldHandle* childArrayFieldHandle = caf::SelectionManager::instance()->activeChildArrayFieldHandle();
|
caf::PdmChildArrayFieldHandle* childArrayFieldHandle = caf::SelectionManager::instance()->activeChildArrayFieldHandle();
|
||||||
|
|||||||
@@ -57,12 +57,12 @@ class PdmChildArrayFieldHandle;
|
|||||||
class SelectionManager
|
class SelectionManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum SelectionRole
|
enum SelectionLevel
|
||||||
{ // Suggested renaming:
|
{
|
||||||
BASE_LEVEL, // BASE_LEVEL = 0,
|
UNDEFINED = -1,
|
||||||
CURRENT, // FIRST_LEVEL = 1,
|
BASE_LEVEL = 0,
|
||||||
// SECOND_LEVEL = 2,
|
FIRST_LEVEL = 1,
|
||||||
UNDEFINED = -1
|
SECOND_LEVEL = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ bool PdmUiLineEditor::isMultipleFieldsWithSameKeywordSelected(PdmFieldHandle* ed
|
|||||||
|
|
||||||
// For current selection, find all fields with same keyword
|
// For current selection, find all fields with same keyword
|
||||||
std::vector<PdmUiItem*> items;
|
std::vector<PdmUiItem*> items;
|
||||||
SelectionManager::instance()->selectedItems(items, SelectionManager::CURRENT);
|
SelectionManager::instance()->selectedItems(items, SelectionManager::FIRST_LEVEL);
|
||||||
|
|
||||||
for (size_t i = 0; i < items.size(); i++)
|
for (size_t i = 0; i < items.size(); i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include "cafPdmChildArrayField.h"
|
#include "cafPdmChildArrayField.h"
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
#include "cafPdmUiTableViewEditor.h"
|
#include "cafPdmUiTableViewEditor.h"
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include "cafPdmUiCommandSystemProxy.h"
|
#include "cafPdmUiCommandSystemProxy.h"
|
||||||
@@ -152,9 +153,9 @@ void PdmUiTableView::enableHeaderText(bool enable)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void PdmUiTableView::setSelectionRole(SelectionManager::SelectionRole role)
|
void PdmUiTableView::setSelectionLevel(int selectionLevel)
|
||||||
{
|
{
|
||||||
m_listViewEditor->setSelectionRole(role);
|
m_listViewEditor->setSelectionLevel(selectionLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#include "cafNotificationCenter.h"
|
#include "cafNotificationCenter.h"
|
||||||
#include "cafPdmUiFieldEditorHandle.h"
|
#include "cafPdmUiFieldEditorHandle.h"
|
||||||
#include "cafSelectionManager.h"
|
//#include "cafSelectionManager.h"
|
||||||
|
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@@ -69,7 +69,7 @@ public:
|
|||||||
void setChildArrayField(PdmChildArrayFieldHandle* childArrayField);
|
void setChildArrayField(PdmChildArrayFieldHandle* childArrayField);
|
||||||
void setUiConfigurationName(QString uiConfigName);
|
void setUiConfigurationName(QString uiConfigName);
|
||||||
void enableHeaderText(bool enable);
|
void enableHeaderText(bool enable);
|
||||||
void setSelectionRole(SelectionManager::SelectionRole role);
|
void setSelectionLevel(int selectionLevel);
|
||||||
|
|
||||||
PdmObjectHandle* pdmObjectFromModelIndex(const QModelIndex& mi);
|
PdmObjectHandle* pdmObjectFromModelIndex(const QModelIndex& mi);
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
#include "cafPdmUiEditorHandle.h"
|
#include "cafPdmUiEditorHandle.h"
|
||||||
#include "cafPdmUiTableViewDelegate.h"
|
#include "cafPdmUiTableViewDelegate.h"
|
||||||
#include "cafPdmUiTableViewQModel.h"
|
#include "cafPdmUiTableViewQModel.h"
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
@@ -72,7 +73,7 @@ PdmUiTableViewEditor::PdmUiTableViewEditor()
|
|||||||
|
|
||||||
m_checkboxDelegate = new PdmUiCheckBoxDelegate(this);
|
m_checkboxDelegate = new PdmUiCheckBoxDelegate(this);
|
||||||
|
|
||||||
m_selectionRole = SelectionManager::CURRENT;
|
m_selectionLevel = SelectionManager::FIRST_LEVEL;
|
||||||
m_isBlockingSelectionManagerChanged = false;
|
m_isBlockingSelectionManagerChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +143,7 @@ void PdmUiTableViewEditor::configureAndUpdateUi(const QString& uiConfigName)
|
|||||||
{
|
{
|
||||||
PdmUiTableViewEditorAttribute editorAttrib;
|
PdmUiTableViewEditorAttribute editorAttrib;
|
||||||
childArrayFH->ownerObject()->uiCapability()->editorAttribute(childArrayFH, uiConfigName, &editorAttrib);
|
childArrayFH->ownerObject()->uiCapability()->editorAttribute(childArrayFH, uiConfigName, &editorAttrib);
|
||||||
this->setSelectionRole(editorAttrib.selectionRole);
|
this->setSelectionLevel(editorAttrib.selectionLevel);
|
||||||
this->enableHeaderText(editorAttrib.enableHeaderText);
|
this->enableHeaderText(editorAttrib.enableHeaderText);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,9 +231,9 @@ void PdmUiTableViewEditor::enableHeaderText(bool enable)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void PdmUiTableViewEditor::setSelectionRole(SelectionManager::SelectionRole role)
|
void PdmUiTableViewEditor::setSelectionLevel(int selectionLevel)
|
||||||
{
|
{
|
||||||
m_selectionRole = role;
|
m_selectionLevel = selectionLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -242,10 +243,10 @@ void PdmUiTableViewEditor::onSelectionManagerSelectionChanged(int selectionLevel
|
|||||||
{
|
{
|
||||||
if (m_isBlockingSelectionManagerChanged) return;
|
if (m_isBlockingSelectionManagerChanged) return;
|
||||||
|
|
||||||
if (isSelectionRoleDefined() && (m_selectionRole == selectionLevel))
|
if (isSelectionRoleDefined() && (m_selectionLevel == selectionLevel))
|
||||||
{
|
{
|
||||||
std::vector<PdmUiItem*> items;
|
std::vector<PdmUiItem*> items;
|
||||||
SelectionManager::instance()->selectedItems(items, m_selectionRole);
|
SelectionManager::instance()->selectedItems(items, m_selectionLevel);
|
||||||
|
|
||||||
QItemSelection totalSelection;
|
QItemSelection totalSelection;
|
||||||
for (auto item: items)
|
for (auto item: items)
|
||||||
@@ -274,7 +275,7 @@ void PdmUiTableViewEditor::slotSelectionChanged(const QItemSelection & selected,
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool PdmUiTableViewEditor::isSelectionRoleDefined() const
|
bool PdmUiTableViewEditor::isSelectionRoleDefined() const
|
||||||
{
|
{
|
||||||
return m_selectionRole != SelectionManager::UNDEFINED;
|
return m_selectionLevel != SelectionManager::UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -320,7 +321,7 @@ void PdmUiTableViewEditor::updateSelectionManagerFromTableSelection()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_isBlockingSelectionManagerChanged = true;
|
m_isBlockingSelectionManagerChanged = true;
|
||||||
SelectionManager::instance()->setSelectedItems(items, m_selectionRole);
|
SelectionManager::instance()->setSelectedItems(items, m_selectionLevel);
|
||||||
m_isBlockingSelectionManagerChanged = false;
|
m_isBlockingSelectionManagerChanged = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,8 @@
|
|||||||
#include "cafPdmDocument.h"
|
#include "cafPdmDocument.h"
|
||||||
#include "cafPdmUiFieldEditorHandle.h"
|
#include "cafPdmUiFieldEditorHandle.h"
|
||||||
#include "cafPdmUiObjectEditorHandle.h"
|
#include "cafPdmUiObjectEditorHandle.h"
|
||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionChangedReceiver.h"
|
||||||
|
//#include "cafSelectionManager.h"
|
||||||
|
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
@@ -58,6 +59,7 @@ class PdmUiFieldEditorHandle;
|
|||||||
class PdmUiItem;
|
class PdmUiItem;
|
||||||
class PdmUiTableViewDelegate;
|
class PdmUiTableViewDelegate;
|
||||||
class PdmUiTableViewQModel;
|
class PdmUiTableViewQModel;
|
||||||
|
class PdmChildArrayFieldHandle;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@@ -81,13 +83,13 @@ class PdmUiTableViewEditorAttribute : public PdmUiEditorAttribute
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PdmUiTableViewEditorAttribute()
|
PdmUiTableViewEditorAttribute()
|
||||||
: selectionRole(SelectionManager::CURRENT)
|
: selectionLevel(1)
|
||||||
, enableHeaderText(true)
|
, enableHeaderText(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionManager::SelectionRole selectionRole;
|
int selectionLevel;
|
||||||
bool enableHeaderText;
|
bool enableHeaderText;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -105,7 +107,7 @@ public:
|
|||||||
~PdmUiTableViewEditor();
|
~PdmUiTableViewEditor();
|
||||||
|
|
||||||
void enableHeaderText(bool enable);
|
void enableHeaderText(bool enable);
|
||||||
void setSelectionRole(SelectionManager::SelectionRole role);
|
void setSelectionLevel(int selectionLevel);
|
||||||
|
|
||||||
PdmObjectHandle* pdmObjectFromModelIndex(const QModelIndex& mi);
|
PdmObjectHandle* pdmObjectFromModelIndex(const QModelIndex& mi);
|
||||||
QTableView* tableView();
|
QTableView* tableView();
|
||||||
@@ -140,7 +142,7 @@ private:
|
|||||||
PdmUiCheckBoxDelegate* m_checkboxDelegate;
|
PdmUiCheckBoxDelegate* m_checkboxDelegate;
|
||||||
|
|
||||||
bool m_useDefaultContextMenu;
|
bool m_useDefaultContextMenu;
|
||||||
SelectionManager::SelectionRole m_selectionRole;
|
int m_selectionLevel;
|
||||||
bool m_isBlockingSelectionManagerChanged;
|
bool m_isBlockingSelectionManagerChanged;
|
||||||
|
|
||||||
caf::PdmChildArrayFieldHandle* m_previousFieldHandle;
|
caf::PdmChildArrayFieldHandle* m_previousFieldHandle;
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ void PdmUiTreeViewEditor::customMenuRequested(QPoint pos)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
PdmChildArrayFieldHandle* PdmUiTreeViewEditor::currentChildArrayFieldHandle()
|
PdmChildArrayFieldHandle* PdmUiTreeViewEditor::currentChildArrayFieldHandle()
|
||||||
{
|
{
|
||||||
PdmUiItem* currentSelectedItem = SelectionManager::instance()->selectedItem(SelectionManager::CURRENT);
|
PdmUiItem* currentSelectedItem = SelectionManager::instance()->selectedItem(SelectionManager::FIRST_LEVEL);
|
||||||
|
|
||||||
PdmUiFieldHandle* uiFieldHandle = dynamic_cast<PdmUiFieldHandle*>(currentSelectedItem);
|
PdmUiFieldHandle* uiFieldHandle = dynamic_cast<PdmUiFieldHandle*>(currentSelectedItem);
|
||||||
if (uiFieldHandle)
|
if (uiFieldHandle)
|
||||||
|
|||||||
Reference in New Issue
Block a user