Skip to content

fix(env): Environment Variables ✕ button never removed rows - #53

Merged
I4cTime merged 1 commit into
mainfrom
fix/52-env-remove-row
Jul 25, 2026
Merged

fix(env): Environment Variables ✕ button never removed rows#53
I4cTime merged 1 commit into
mainfrom
fix/52-env-remove-row

Conversation

@I4cTime

@I4cTime I4cTime commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #52 — pressing the ✕ button in the Environment Variables editor did nothing, for every user.

Root cause: QML's model.removeRow(i) resolves to QAbstractItemModel's built-in invokable C++ removeRow(int, parent) convenience, not the same-named Python slot the model defined — the Python slot was unreachable from QML. The C++ convenience delegates to the virtual removeRows(), which the model never overrode, so the call landed in the base-class stub that does nothing and returns false. (The old comment claimed removeRow was the virtual — it isn't; removeRows is.)

Fix: drop the shadowed Python removeRow slot and override the removeRows(row, count, parent) virtual — the hook Qt actually dispatches to. The existing QML call site works unchanged, removal marks the editor dirty, and out-of-range/invalid-parent calls are rejected.

Regression test: tests/test_env_remove_row.py drives model.removeRow(i) through a real (offscreen) QML engine, so the exact dispatch path that broke is the one under test — a plain Python-side call would have passed even with the bug.

Ships as v1.0.1: version bumped in pyproject.toml / __init__.py, changelog entry, and Flatpak metainfo release entry added.

Type

  • Fix

Checklist

  • ruff check protonshift passes
  • pytest passes (44 passed, incl. 2 new regression tests)
  • pyside6-qmllint — no QML changes
  • CHANGELOG.md updated (as the [1.0.1] section)
  • Docs — no behavior/layout docs affected
  • Flatpak metainfo: 1.0.1 release entry added
  • test_core_safety.py — not touching shader_cache/scopebuddy regexes
  • Theme parity — no palette changes

Breaking changes

None.

🤖 Generated with Claude Code

)

QML's model.removeRow(i) resolves to QAbstractItemModel's built-in C++
convenience, not the same-named Python slot, so the slot was unreachable
and the call fell through to the default removeRows() stub that does
nothing and returns false. Override the removeRows() virtual instead —
the hook the C++ convenience actually delegates to.

Adds a regression test that drives the call through a real QML engine
(offscreen) so the broken dispatch path is the one under test. Bumps to
1.0.1 with changelog + metainfo release entry.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@I4cTime
I4cTime merged commit 6aea03c into main Jul 25, 2026
4 checks passed
@I4cTime
I4cTime deleted the fix/52-env-remove-row branch July 25, 2026 08:07
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.

Can't remove keys from Environment Variables

1 participant