Skip to content

feat(gui): delete button on hover in signal and image lists - #450

Merged
PierreRaybaut merged 4 commits into
developfrom
feature/449-object-list-delete-button
Oct 28, 2026
Merged

PierreRaybaut merged 4 commits into
developfrom
feature/449-object-list-delete-button

Conversation

@PierreRaybaut

@PierreRaybaut PierreRaybaut commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes #449

Summary

As in DataLab-Web, signals, images and groups can now be deleted directly from the signal and image lists, with an inline delete button revealed on hover.

  • Hover highlight: the item under the mouse cursor is subtly highlighted (#e5f3ff in light mode, #2d3138 in dark mode), whatever the Qt style. Previously, hovered items were not highlighted at all in dark mode (Fusion style). The highlight covers the whole row, branch area included.
  • Delete button: a trash button appears at the right edge of the visible part of the hovered row (it stays there when long titles make the list scroll horizontally). The title is clipped before the button. Hovering the button turns it red (#c4302b, DataLab-Web's danger color) and shows a tooltip telling what it deletes ("Delete this signal/image/group", "Delete the N selected objects/groups").
  • Behavior on click (same as DataLab-Web):
    • if the item is part of the selection, the whole selection is deleted;
    • otherwise only this item is deleted, and the current selection (and displayed objects) is preserved;
    • a confirmation is always asked (skipped in unattended mode).
  • History: the deletion goes through the existing removal path, recorded as "Remove selected objects" with the deleted items as captured selection, so it replays correctly.
  • Setting: new Show delete button when hovering list items option (Settings > Visualization > Common, enabled by default), applied without restart. The hover highlight is kept when the button is hidden.

Implementation notes

  • datalab/widgets/titledelegate.py: hover_background_color(); the delegate replaces the native hover feedback of unselected items by this color, and clips rich titles at the X coordinate given by the optional text_clip_provider callback.
  • datalab/gui/objectview.py:
    • SimpleObjectTree enables hover events on its viewport (and restores them after style changes, as windowsvista disables them when unpolishing item views), tracks the hovered item from the same events as the view, and highlights its branch area.
    • ObjectView paints the button in drawRow, handles press/release (standard button semantics, no selection or drag from the button, double-clicks on it ignored), the tooltip, and emits SIG_DELETE_REQUESTED(uuid). __select_uuids becomes the public select_uuids(uuids, notify=True).
  • datalab/gui/panel/base.py: remove_object is split so that the button path (__delete_from_button) reuses the same history recording and removal code, then restores the previous selection before the single selection_changed refresh.
  • datalab/utils/qthelpers.py: event_pos() and view_item_option() Qt 5/Qt 6 helpers, used by the object tree mouse and hover handlers (pos() and viewOptions() are not available with PyQt6).

Tests

  • New datalab/tests/features/common/objview_delete_button_unit_test.py: button geometry (including horizontal scroll), tooltips, deletion of an unselected object (selection preserved, history entry), of the selection, of groups, confirmation refusal, no selection/drag/separate view from the button, setting, hover events kept after style changes.
  • datalab/tests/backbone/titledelegate_unit_test.py: hover background for every available style in light and dark modes (with contrast checks), title clipping.
  • Regression: backbone, settings, history (panel, workflow, replay fixes), bulk object operations, titles, welcome page, operation modes, reorder, HDF5 workspace, plugin tools... (443 + 89 tests passed locally). New and object view tests also pass locally with PyQt6 6.11. Ruff and Pylint clean on modified files. Sphinx gettext build passes with -W.

Documentation

  • doc/features/common/overview.rst and doc/features/common/settings.rst, release notes 1.4, with French translations (UI and documentation).
  • The settings_view_common.png screenshot (manual capture) does not show the new option yet.

As in DataLab-Web, the signal, image or group under the mouse cursor is
highlighted, and a delete button appears at the right edge of the visible
part of its row. The button turns red when hovered and its tooltip tells what
it deletes.

Clicking it deletes the item, or the whole selection if the item is part of
it, after confirmation. Deleting an unselected item keeps the current
selection. The deletion goes through the Remove path, so it is recorded in
the History panel as the removal of the deleted items.

- Hovered items are highlighted with the same discreet color whatever the Qt
  style, in light and dark modes (Fusion did not highlight them), including
  their branch area; hover events are kept after style changes
- The title of the hovered item is clipped before the button
- New "Show delete button when hovering list items" setting (Visualization >
  Common, enabled by default), applied without restart
- French translations

Closes #449

Assisted-by: Claude Opus 5.5
- Object view: geometry of the button (hovered item only, right edge of the
  visible viewport, also when scrolled horizontally), tooltips, deletion of an
  unselected object (selection preserved, history entry), of the selection, of
  groups, confirmation refusal, no selection/drag/separate view from the
  button, setting, hover events kept after style changes
- Title delegate: hover background for every style in light and dark modes,
  text clipping before the button

Assisted-by: Claude Opus 5.5
Overview, settings and release notes, with French translations.

Assisted-by: Claude Opus 5.5
@PierreRaybaut PierreRaybaut added the enhancement New feature or request label Oct 28, 2026
The object tree read event positions with the Qt 5 `pos()` API and the
style option of its items with `viewOptions()`, removed in Qt 6: mouse and
hover events over the tree, and the tests of the delete button, failed with
PyQt6.

- New `event_pos` and `view_item_option` helpers in `datalab.utils.qthelpers`,
  supporting Qt 5 and Qt 6
- Tests build hover events with `QPointF` positions, as Qt 6 requires

Assisted-by: Claude Opus 5.5
@PierreRaybaut
PierreRaybaut merged commit 9e07d67 into develop Oct 28, 2026
6 checks passed
@PierreRaybaut
PierreRaybaut deleted the feature/449-object-list-delete-button branch October 29, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant