#3531 Clear all selected objects as part of reload case

This commit is contained in:
Magne Sjaastad 2018-10-22 13:41:52 +02:00
parent 82ad3ee675
commit 158222217a

View File

@ -2,17 +2,17 @@
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
//
// ResInsight 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.
//
//
// ResInsight 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -21,6 +21,8 @@
#include "RimEclipseCase.h"
#include "RiuSelectionManager.h"
#include "cafPdmObject.h"
#include "cafSelectionManager.h"
@ -29,13 +31,14 @@
CAF_CMD_SOURCE_INIT(RicReloadCaseFeature, "RicReloadCaseFeature");
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicReloadCaseFeature::isCommandEnabled()
{
std::vector<caf::PdmObject*> selectedFormationNamesCollObjs;
caf::SelectionManager::instance()->objectsByType(&selectedFormationNamesCollObjs);
for (caf::PdmObject* pdmObject : selectedFormationNamesCollObjs) {
for (caf::PdmObject* pdmObject : selectedFormationNamesCollObjs)
{
if (dynamic_cast<RimEclipseCase*>(pdmObject))
{
return true;
@ -46,13 +49,16 @@ bool RicReloadCaseFeature::isCommandEnabled()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicReloadCaseFeature::onActionTriggered(bool isChecked)
{
std::vector<RimEclipseCase*> selectedEclipseCases;
caf::SelectionManager::instance()->objectsByType(&selectedEclipseCases);
RiuSelectionManager::instance()->deleteAllItems();
caf::SelectionManager::instance()->clearAll();
for (RimEclipseCase* selectedCase : selectedEclipseCases)
{
selectedCase->reloadDataAndUpdate();
@ -60,7 +66,7 @@ void RicReloadCaseFeature::onActionTriggered(bool isChecked)
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicReloadCaseFeature::setupActionLook(QAction* actionToSetup)
{