Commit Graph
1539 Commits
Author SHA1 Message Date
Magne Sjaastad b4cefd6382 Remove unused action push button 2026-01-23 13:31:34 +01:00
JJ 3e06a61ed5 Popup window placement improvements (#13464)
* Improve parent settings for message boxes and progress info
2026-01-21 19:11:41 +01:00
Kristian Bendiksen c368b51061 #1958 Remove unused cafPdmUiListView
Fixes #1958.
2026-01-21 12:57:42 +01:00
Kristian Bendiksen 8b13dbcef1 #12940 Fix empty vector parsing and ReadPastEnd handling for Python GRPC
- 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
2026-01-21 08:41:09 +01:00
Kristian Bendiksen 6a1c74bdfc #12940 Add option to only parse in strict mode used from python 2026-01-21 08:41:09 +01:00
Kristian Bendiksen 89bfaa7fd9 #12940 Fix optional field handling for empty input in PDM scripting
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
2026-01-21 08:41:09 +01:00
Kristian Bendiksen d06280cca8 #12940 Strict type validation and improved Enum error handling for Python GRPC
- 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.
2026-01-21 08:41:09 +01:00
Magne Sjaastad 9851afc621 #2070 AppFwk : Disable default IO for proxy 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)
2026-01-19 16:10:14 +01:00
Magne Sjaastad 526a0f0b43 Replaces direct attribute access with map-based system
Migrates UI editor attribute definitions from direct member access in `defineEditorAttribute` to a map-based system using `setAttribute`.
2026-01-08 21:44:58 +01:00
Magne Sjaastad 6e23037bb8 Refactors PdmUiItemInfo and PdmOptionItemInfo
Refactors PdmUiItem and moves PdmUiItemInfo and PdmOptionItemInfo classes.

Adds attribute support as a replacement for defineEditorAttributes
2026-01-08 21:44:58 +01:00
Kristian Bendiksen bd7e5ac1b9 Refactor: reduce duplicated code for collections 2026-01-05 13:15:47 +01:00
Magne Sjaastad 405a32e2da Removes QIntValidator and uses setRange
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.
2025-12-22 10:17:00 +01:00
Magne Sjaastad 4488a7215d Replaces stylesheet-based validation styling with icon indicator
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
2025-12-22 10:17:00 +01:00
Magne Sjaastad 4d312ecc82 #13358 Clamp values to valid range when reading project files 2025-12-19 13:06:13 +01:00
JJ 64b5dcd1b9 Add validation to sector model export wizard (#13348)
* Add validation to sector model export wizard
2025-12-17 13:16:10 +01:00
Magne Sjaastad 2adc96782e Adds validation test object to test application
Adds a new test object that demonstrates field validation features.
2025-12-16 13:01:31 +01:00
Magne Sjaastad e09baf3e80 Show red frame around editor widget, and show validation message in tooltip 2025-12-16 13:01:31 +01:00
Magne Sjaastad f342ca7757 Add validation to field and object
Add support for optional range checking in PdmDataValueField
2025-12-16 13:01:31 +01:00
Magne Sjaastad 9fa002abec Reduce number of objects to avoid long-running unit test in some cases 2025-12-16 13:01:31 +01:00
Magne Sjaastad 2429778f25 Handles infinite and NaN values in slider
In debug build, an assert is triggered for inf or NaN double values.
2025-12-08 15:22:00 +01:00
Magne Sjaastad f230998fff #13256 Framework: Make sure labels and buttons are deleted
Make sure standalone labels and buttons are deleted between multiple calls to defineUiOrdering.
2025-12-01 14:10:34 +01:00
Magne Sjaastad c035c31a0d Use deleteLater
Uses deleteLater to avoid issues when deleting radio buttons from signal handlers, resolving a crash observed during focus changes.
2025-11-30 10:35:30 +01:00
Magne Sjaastad e71172fa39 Fix more qt 6.10 bugs 2025-11-30 10:35:30 +01:00
jonjenssen 070b0fd46e Add code to reproduce crash from ResInsight 2025-11-30 10:35:30 +01:00
Magne Sjaastad 760137730b #13243 Always recreate non-field labels and buttons 2025-11-28 15:49:31 +01:00
Magne Sjaastad 47fd2e375c Add GroupBox around radio buttons 2025-11-26 11:34:59 +01:00
Magne Sjaastad 88b88e6d1e Add radio button editor for application enums (#13228) 2025-11-25 07:02:00 +01:00
Magne Sjaastad 40fbb6038f #13203 Replaces UiTreeItem with UiTreeManager
Substitutes the template-based UiTreeItem with an index-based UiTreeManager.
2025-11-20 12:39:57 +01:00
Magne Sjaastad 544e9eedd9 Improve spell checker using codespell
* 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.
2025-11-19 10:25:32 +01:00
Magne Sjaastad 6c5ef081af Guards dataChanged signal emission
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.
2025-11-17 19:44:08 +01:00
Kristian Bendiksen 5a7e987034 Refactor: Use VecIjk0 instead of Vec3st. 2025-11-17 13:04:13 +01:00
Kristian Bendiksen 3b81080086 Add caf::VecIjk0 and caf::VecIjk1. 2025-11-14 14:44:21 +01:00
Kristian Bendiksen c15956cf98 Vec3: allow ijk indexing for integral vectors. 2025-11-14 14:44:21 +01:00
Magne Sjaastad c2c26bc7c0 Add missing clear of label and button cache 2025-10-21 12:26:30 +02:00
Magne Sjaastad 2012c003dc #13044 Add support for labels and push buttons without a Pdm field
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.
2025-10-20 09:23:06 +02:00
Magne Sjaastad 4d24b019dc clang: Fix compile warnings and add sanitizer supressions 2025-10-20 09:22:09 +02:00
Magne Sjaastad e6fca7c06c Enables labels to display hyperlinks
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.
2025-10-17 07:43:51 +02:00
Magne Sjaastad 51000a5516 Decorates optional fields with information icon
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.
2025-10-15 14:34:04 +02:00
Magne Sjaastad ddb0afe3d2 Fixes focus out event on combo box
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.
2025-10-10 07:16:28 +02:00
Magne Sjaastad 65e61767f4 Fix typo and restore filter for tree view after update 2025-10-09 11:14:45 +02:00
Magne Sjaastad a9e42e017a #12983 Clears filter during tree update
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.
2025-10-07 12:17:42 +02:00
Kristian Bendiksen 5c48383d71 Refactor: Improve interface for characteristicCellSize() 2025-10-06 09:10:58 +02:00
Magne Sjaastad be283f39b4 #12972 Python: Detect duplicated method names 2025-10-02 14:01:37 +02:00
Magne Sjaastad cfb2dfa9c9 Add testing to CAF logging 2025-09-30 14:22:03 +02:00
Magne Sjaastad 0f339a6ab2 Writes optional value directly to stream
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.
2025-09-24 12:50:21 +02:00
Magne Sjaastad 772f7ac93c Make sure well targets are available as table editor
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.
2025-09-13 20:16:42 +02:00
Magne Sjaastad df965a4a16 Add default line editors for some std::optional types 2025-09-11 13:44:25 +02:00
Magne Sjaastad 8251562cd9 Add logging to CAF 2025-09-11 13:42:56 +02:00
Kristian Bendiksen aa5ea73ccb Revert "Fix QWidgetItem memory leak in PdmUiFieldEditorHandle destructor"
This reverts commit 2f4f97c80b.
2025-09-08 18:07:02 +02:00
Kristian Bendiksen 6d602fb76d Fix memory leak.
m_commandData created with new, but never deleted.
2025-09-04 09:04:30 +02:00