- Handle empty arrays [] in std::vector<cvf::Vec3d> parser
- Only treat ReadCorruptData as error in generic template (ReadPastEnd
is expected for types like caf::FilePath that consume all input)
- Use strict mode (allowExtraCharacters=false) for Python GRPC parsing
Fixes cafPdmScripting_UnitTests::PdmFieldSerialization.OptionalValues test
failure where empty input for std::optional<int> and std::optional<double>
fields was incorrectly set to default values (0) instead of remaining unset.
Problem:
- Optional handler used error count to determine parsing success
- Empty stream reads set value to 0 but didn't add errors (only checked ReadCorruptData)
- Result: optional fields set to 0 instead of remaining unset
Solution:
- Modified optional handler to check for empty input before parsing
- Empty input now correctly leaves optional field unset (no error)
- Maintains strict validation for invalid input (adds error, resets optional)
Changes:
- PdmFieldScriptingCapabilityIOHandler<std::optional<T>>: Check atEnd() before parsing
- int/double handlers: Only call checkForExtraCharactersAfterValue() on success
Testing:
- All cafPdmScripting_UnitTests pass (8/8)
- All test_pdmobject_validation.py tests pass (10/10)
- Optional double fields no longer generate spurious validation errors
- Implemented strict parsing in 'writeToField' handlers to reject values with trailing garbage (e.g. '100.5test' for double, '0.99' for int/enum).
- Improved 'AppEnum' validation error message to list all valid options when an invalid value is provided.
- Added new test file 'test_validation_types_issue_12940.py' verifying strict type validation for double, int, and enum fields.
Proxy fields usually reads and transforms data from other sources, usually other Pdm fields. This commit disables IO for proxy fields in the constructor. If XML serialization is required, this must be set on the proxy field, like this
field.xmlCapability()->setIOWritable(true)
field.xmlCapability()->setIOReadable(true)
Replaces the usage of `QIntValidator` with the `setRange` function available in the PDM framework for limiting integer input in UI fields.
This approach provides a more direct and maintainable way to specify value ranges for UI elements.
This change simplifies the code and reduces dependencies.
Uses QWidget::addAction() to show a warning icon for validation errors, similar to the information icon for optional fields. The error message appears in the icon's tooltip, avoiding stylesheet manipulation that was causing tooltip rendering issues.
- Adds warning icon to widgets with validation errors
- Preserves field tooltips (e.g., "Valid range: ...")
- Uses QPointer for automatic null-safety
- Works with QLineEdit and other widgets
* Configures automated spell checking with codespell
Adds GitHub workflows and configuration files for automated spell checking using `codespell`.
This includes:
- A workflow for checking pull requests and preventing new typos
- A workflow for automatically fixing typos in the main codebase
- Configuration files for `codespell` to ignore specific terms and file types
- Documentation on how to use and configure the spell checking workflows.
* Corrects minor spelling and grammar errors.
Ensures that the dataChanged signal is only emitted if the index is valid.
This prevents potential issues when the index is invalid, such as during object destruction.
Introduces `PdmUiLabel` and `PdmUiButton` classes to enable the addition of labels and buttons directly within the UI configuration, without requiring a bound PDM field.
This enhancement provides greater flexibility in constructing user interfaces and allows direct user interaction via button callbacks.
It also updates the `PdmUiOrdering` to support label and button components, and modifies the `PdmUiFormLayoutObjectEditor` to properly render these new UI elements.
Introduces the ability for labels to display hyperlinks.
This is achieved by adding a `setLabelText` function to handle both regular and shortened labels and allowing a callback function to be executed when the link is activated.
Adds a test object with labels and hyperlinks to the test application.
Adds an information icon to optional fields, providing users
with a visual cue indicating that the field is not mandatory.
Renames `createTwoStateChainIcon` to `twoStateChainIcon` to
better reflect its purpose.
Connects the focus out event of the combo box to a slot that sets the current text to the field.
This ensures that the entered text is saved when the combo box loses focus.
Avoids infinite recursion when updating the tree while a search filter is active.
This can occur when a calculation is parsed and a filter is active, causing a rebuild of the tree and infinite recursion.
The change directly writes the value of an `std::optional` to the output stream.
If an optional is undefined, nothing is written to the TextStream. Parsing of data coming from Python to C++ is improved to handle no data.
In 8251562cd9, logging was activated when no field editor could be created. This happens for PdmChildArray fields and PdmChildFields. A early return checking for these types was added, and caused well targets to be hidden from the property editor.