-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: Virtual functions | ||
permalink: /object/virtual-functions | ||
layout: default | ||
--- | ||
|
||
## Overview of virtual functions | ||
|
||
A PDM object inherits PdmObject which inherits PdmUiObjectHandle. This documents gives an overview of virtual functions that can be overridden with short examples of usage. | ||
[cafPdmUiObjectHandle()](https://github.com/OPM/ResInsight/blob/dev/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h) | ||
|
||
## appendMenuItems | ||
Used to append menu items to the right click menu of an object. Previous pattern created these menus centralized in RimContextCommandBuilder which will be obsoleted. | ||
|
||
void RimPolygon::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const | ||
{ | ||
menuBuilder << "RicDuplicatePolygonFeature"; | ||
menuBuilder << "Separator"; | ||
menuBuilder << "RicExportPolygonCsvFeature"; | ||
} | ||
|
||
## userDescriptionField | ||
If defined, the string defined by this field will be used when displaying object text in the Property Tree. | ||
|
||
caf::PdmFieldHandle* RimNamedObject::userDescriptionField() | ||
{ | ||
return nameField(); | ||
} | ||
|
||
## objectToggleField | ||
If defined, displays a checkbox next to the object in the Project Tree. The field must be of the boolean type. | ||
|
||
caf::PdmField<bool> m_isActive; | ||
caf::PdmFieldHandle* RimCellFilter::objectToggleField() | ||
{ | ||
return &m_isActive; | ||
} | ||
|
||
## fieldChangedByUi | ||
Use this method to react on user interaction in the user interface. A pointer to the field being changed, old and new value is available. | ||
|
||
## objectToggleField | ||
If defined, displays a checkbox next to the object in the Project Tree. The field must be of the boolean type. | ||
|
||
void RimPolygon::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) | ||
{ | ||
if ( changedField == &m_pointsInDomainCoords ) | ||
{ | ||
coordinatesChanged.send(); | ||
objectChanged.send(); | ||
} | ||
} | ||
|
||
|
||
|