Skip to content

Machine page destruction - #21778

Open
HellAholic wants to merge 4 commits into
mainfrom
machine_page_destruction
Open

HellAholic wants to merge 4 commits into
mainfrom
machine_page_destruction

Conversation

@HellAholic

@HellAholic HellAholic commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

This pull request improves how in-progress edits are committed in machine settings dialogs, ensuring user changes are saved more reliably when dialogs are closed or focus is lost. It also optimizes value updates to avoid unnecessary processing when values haven't changed.

User input commit and dialog behavior improvements:

  • In MachineSettings/NumericTextFieldWithUnit.qml, edits are now automatically committed when the text field loses focus (including when dialogs close), ensuring user changes aren't lost if the dialog is closed without explicit confirmation.
  • The Component.onDestruction handler was removed in favor of the improved focus handling, preventing redundant or mistimed commits.
  • In Preferences/MachinesPage.qml, the dialog no longer self-destroys immediately, allowing any active edit to be committed before the dialog is closed. The field with focus has its editingFinishedFunction called before destruction, preventing data loss.

Optimizations and correctness:

  • In PrintHeadMinMaxTextField.qml, the code now checks if the value was actually changed before updating, skipping unnecessary JSON parsing and updates if the value is unchanged.
  • In GcodeTextArea.qml, the property value is only updated if the text has actually changed, avoiding redundant updates.

CURA-13309

At any given time only a single field can have unfinished edit, using the generic onDestruction would lead to slow down and each field has a onFinishedEditing trigger. So we only need to save and update the value for a single field rather than triggering it for the entire content.
Update `GcodeTextArea.qml` to only persist the text on destruction when it actually differs from the current property value. This prevents unnecessary `setPropertyValue("value", text)` calls and avoids triggering no-op updates.
Update `NumericTextFieldWithUnit` to apply pending text edits whenever the field loses focus, including when the dialog closes. This replaces the destruction-time commit hook with a focus-based check that only commits when the value actually changed, while keeping tab-focus select-all behavior.
In `PrintHeadMinMaxTextField.qml`, `editingFinishedFunction` now checks whether the parsed input equals `axisValue` before parsing and rewriting the polygon JSON. If unchanged, it restores the binding and returns early, avoiding unnecessary JSON round-trips and reducing work on no-op edits.
@HellAholic HellAholic added PR: Community Contribution 👑 Community Contribution PR's PR: Improving UI 🎨 Like better navigation arrows, fixing scroll bar bugs labels Aug 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

24 955 tests   24 953 ✅  48s ⏱️
     1 suites       2 💤
     1 files         0 ❌

Results for commit d021fed.

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

Labels

PR: Community Contribution 👑 Community Contribution PR's PR: Improving UI 🎨 Like better navigation arrows, fixing scroll bar bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant