Skip to content

Conversation

@aryrk
Copy link

@aryrk aryrk commented Oct 4, 2025

PR split from #72

Originally created for issue #68
Here's before:
image
After:
image

This pull request enhances the handling of optional fields in the TopicTableModel to properly support and display fields that are not present in the data. The changes ensure that optional fields are visually distinguished, cannot be edited when absent, and are handled consistently throughout the data model. Additionally, a new test message with optional fields was added for testing.

The most important changes are:

Optional Field Handling and UI Behavior:

  • Added a notPresent flag to DataRow in TopicTableModel to track if an optional field is absent, along with getter and setter methods (getNotPresent, setNotPresent) and proper initialization. (src/topic_table_model.h, src/topic_table_model.cpp) [1] [2] [3] [4]
  • Updated the flags and setData methods to prevent editing of fields that are not present, ensuring the UI disables editing for such fields. (src/topic_table_model.cpp) [1] [2]
  • In the data method, styled non-present fields in the value column to display "(not present)" in grey text, improving user feedback. (src/topic_table_model.cpp)

Data Model Logic Improvements:

  • Refactored value extraction in setDataRow to set the notPresent flag for missing optional fields and clear it when a value is present, using a new helper lambda for consistency across types. (src/topic_table_model.cpp)
  • Reset the notPresent flag when a value is set via setValue, ensuring correct state after user edits. (src/topic_table_model.cpp)

Testing and Type Support:

  • Added a new OptionalFieldsMessage struct with optional fields to test/test.idl to enable testing of the new logic. (test/test.idl)

Other:

  • Updated the OpenDDW submodule to the latest commit. (thirdparty/OpenDDW)

These changes collectively improve the robustness and user experience of the data table when dealing with optional fields in topic data.

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.

1 participant