Skip to content

Conversation

Copy link

Copilot AI commented Dec 31, 2025

Migration Plan: Replace defineEditorAttribute with Constructor-based Attributes

This PR migrates from the old defineEditorAttribute pattern to the new constructor-based attribute system.

Understanding the Migration Pattern

Old Pattern (defineEditorAttribute):

  • Attributes were set dynamically in defineEditorAttribute() method
  • Called at runtime when UI is configured
  • Separation between field initialization and UI configuration

New Pattern (Constructor):

  • Attributes configured during field initialization in constructor
  • Uses field.uiCapability()->setUiEditorTypeName(), setUiLabelPosition(), etc.
  • Helper methods available: PdmUiNativeCheckBoxEditor::configureFieldForEditor(), etc.

Migration Checklist

  • Understand the migration pattern and examples
  • Identify all files with defineEditorAttribute (298 files found)
  • Start with simple examples to validate the approach
  • Migrate Application preferences files (RiaPreferences*.cpp)
  • Migrate ProjectDataModel files systematically
  • Remove defineEditorAttribute method declarations and implementations
  • Verify no regressions in UI behavior
  • Document the migration for future reference

Files to Process

  • Total files with defineEditorAttribute: 298
  • Starting with: Application preferences classes
  • Then: ProjectDataModel classes systematically
Original prompt

This section details on the original issue you should resolve

<issue_title>Replace defineEditorAttributes with new attribute system</issue_title>
<issue_description>Create a new branch based on https://github.com/magnesj/ResInsight/tree/attributes-in-constructor Commit changes in steps.

Read claude.md for instructions on how to propagate from defineEdtiorAttributes to the new attribute system. Replace all use of defineEditorAttributes.
</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace defineEditorAttributes with new attribute system

2 participants