Repository navigation
feat(gui): delete button on hover in signal and image lists - #450
Merged
Merged
Conversation
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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
#e5f3ffin light mode,#2d3138in 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.#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").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 optionaltext_clip_providercallback.datalab/gui/objectview.py:SimpleObjectTreeenables hover events on its viewport (and restores them after style changes, aswindowsvistadisables them when unpolishing item views), tracks the hovered item from the same events as the view, and highlights its branch area.ObjectViewpaints the button indrawRow, handles press/release (standard button semantics, no selection or drag from the button, double-clicks on it ignored), the tooltip, and emitsSIG_DELETE_REQUESTED(uuid).__select_uuidsbecomes the publicselect_uuids(uuids, notify=True).datalab/gui/panel/base.py:remove_objectis split so that the button path (__delete_from_button) reuses the same history recording and removal code, then restores the previous selection before the singleselection_changedrefresh.datalab/utils/qthelpers.py:event_pos()andview_item_option()Qt 5/Qt 6 helpers, used by the object tree mouse and hover handlers (pos()andviewOptions()are not available with PyQt6).Tests
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.-W.Documentation
doc/features/common/overview.rstanddoc/features/common/settings.rst, release notes 1.4, with French translations (UI and documentation).settings_view_common.pngscreenshot (manual capture) does not show the new option yet.