Skip to content

Conversation

@magnesj
Copy link
Member

@magnesj magnesj commented Jan 6, 2026

Modernization of UI Attribute Handling:

  • Introduces setAttribute in PdmUiItem. This can be used as a replacement for defineEditorAttribute. In a transition period, both concepts can be used.
  • Added comprehensive documentation in CLAUDE.md for the new setAttribute pattern using type-safe Keys structs, replacing the older defineEditorAttribute method.

Moving of classes:

  • Moved classes into separate files: cafPdmUiItemInfo.cpp, cafPdmUiItemInfo.h, cafPdmOptionItemInfo.cpp, and cafPdmOptionItemInfo.h.
// Example of the new setAttribute features
m_comboBoxField.uiCapability()->setAttribute( caf::PdmUiComboBoxEditor::Keys::ADJUST_WIDTH_TO_CONTENTS, true );
m_comboBoxField.uiCapability()->setAttribute( caf::PdmUiComboBoxEditor::Keys::MINIMUM_CONTENTS_LENGTH, 15 );
m_comboBoxField.uiCapability()->setAttribute( caf::PdmUiComboBoxEditor::Keys::BUTTON_TEXT, "Click Me" );

@magnesj magnesj marked this pull request as ready for review January 6, 2026 10:13
@magnesj magnesj requested a review from kriben January 6, 2026 18:21
Copy link
Collaborator

@kriben kriben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! Requested some changes, but most are debatable.

@magnesj magnesj marked this pull request as draft January 7, 2026 13:06
@magnesj magnesj marked this pull request as ready for review January 7, 2026 14:06
@magnesj magnesj requested a review from kriben January 7, 2026 14:06
Copy link
Collaborator

@kriben kriben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Refactors PdmUiItem and moves PdmUiItemInfo and PdmOptionItemInfo classes.

Adds attribute support as a replacement for defineEditorAttributes
Migrates UI editor attribute definitions from direct member access in `defineEditorAttribute` to a map-based system using `setAttribute`.
Explains the migration from the old `defineEditorAttribute`
pattern to the new `setAttribute` pattern using type-safe
Keys structs in the PDM UI editor.

Highlights the benefits of the new pattern, including type
safety, IDE support, self-documentation, maintainability,
and validation.

Provides examples of common attribute usage for different
editor types. Clarifies backward compatibility, noting the
coexistence of both patterns during migration.
Updates the way UI label positions are set for PDM fields.
@magnesj magnesj force-pushed the editor-attributes-02 branch from 398876b to 99bef20 Compare January 8, 2026 18:07
@magnesj magnesj merged commit cfd634e into dev Jan 8, 2026
19 checks passed
@magnesj magnesj deleted the editor-attributes-02 branch January 8, 2026 20:45
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.

3 participants