mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-27 13:47:12 -05:00
Generalise the per-domain "Add Folder" command and the scripting-side add-folder method so they work against any container that exposes caf::PdmNestedCollectionBase. - RicNewNestedCollectionFeature: command feature that walks the selected PdmObject up to the nearest PdmNestedCollectionBase ancestor and calls addNewSubCollection(). Hidden via canAddSubCollection() for leaf containers. - RimcNestedCollectionBase: scripting wrapper exposing the same add-sub-collection action through the Python interface, so generated Python bindings get the operation for free on every derived class. Neither is wired to a concrete collection yet; the per-domain features remain in place until the migration commit replaces them.
38 lines
1.4 KiB
C++
38 lines
1.4 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2026 Equinor ASA
|
|
//
|
|
// 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>
|
|
// for more details.
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
#include "cafCmdFeature.h"
|
|
|
|
//==================================================================================================
|
|
///
|
|
/// Adds a new subcollection ("folder") to the selected caf::PdmNestedCollection-derived object.
|
|
/// Works with any nested collection type via caf::PdmNestedCollectionBase.
|
|
///
|
|
//==================================================================================================
|
|
class RicNewNestedCollectionFeature : public caf::CmdFeature
|
|
{
|
|
CAF_CMD_HEADER_INIT;
|
|
|
|
private:
|
|
bool isCommandEnabled() const override;
|
|
void onActionTriggered( bool isChecked ) override;
|
|
void setupActionLook( QAction* actionToSetup ) override;
|
|
};
|