fix: show the full slider tooltip when hovering its title, not just the groove - #770
Merged
Conversation
…he groove
A CompactSlider's title QLabel carried its own tooltip ("<name> (double-click
to reset)"), and Qt only propagates a tooltip to the parent when the child has
none — so the explanatory text set on the container was unreachable from the
label. Mirror the container's tooltip onto the label, with a "Double-click to
reset" footer appended to both halves so the gesture stays advertised.
wrap_tooltip() grows an optional footer argument, appended inside the <qt>
document, so callers don't re-implement its escape-vs-passthrough rule.
Also fixes the inverse case in the export form, where four sliders tooltipped
.label directly and left the groove with no tooltip at all.
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.
Problem
Every sidebar slider is a
CompactSlider: a containerQWidgetholding a titleQLabel, an edited dot, a spin box and the groove. The explanatory tooltips (plus shortcut key chips) are set on the container, mostly fromControlsPanel.apply_shortcut_tooltips().Qt propagates a tooltip from a child to its parent only when the child has none of its own.
CompactSlider.__init__gave the label its own tooltip:so hovering the groove surfaced the rich text, but hovering the title only repeated the control name. That was the only place in the slider stack that tooltipped a label.
Fix
wrap_tooltip()gains an optionalfooter— trusted markup appended inside the<qt>document, so callers adding a boilerplate line don't re-implement its escape-vs-passthrough rule. Existing single-argument callers are unaffected.BaseSlider.setToolTipappends aDouble-click to resetfooter;CompactSlider.setToolTipmirrors the wrapped result onto the label, so both halves are identical.toolTip()returns the already-wrapped string, so the footer is never appended twice.<name>+ hint on both halves — previously the groove showed nothing at all for those.THEME.text_secondary, nottext_muted:#555on the#161616tooltip background is ~2.4:1.Also fixes the inverse case in
export_settings_form.py, where four sliders tooltipped.labeldirectly and left the container bare, so their groove had no tooltip.Rendered result (prose, right-floated key chips, hint line):
Not covered
clone_sliderstill doesn't copysrc.toolTip(), so Favourites mirrors show only name + hint. Pre-existing and unchanged here; a correct fix needs the raw pre-wrap text stashed on the source and re-copied on every rebind.Test plan
tests/test_slider_tooltips.py: label == container, hint present exactly once, chip<table>survives unescaped and precedes the hint, plain<still escaped, export-form containers tooltipped.make allgreen — ruff, ty, 3475 passed / 5 skipped.QTextDocumentto confirm layout and that no tags leak as literal text.