Skip to content

Expandable ToolTips

Felix Ernst requested to merge (removed):ktooltiphelper into master


This MR adds a small hint to tooltips which can be expanded. Pressing Shift will show the expanded help in a widget that isn't hidden when the mouse moves. This is necessary so we can have clickable links there which will allow us to refer users to the manual, community wiki etc. which makes these resources more readily available and helps us avoid duplicating their work. It also allows us to keep the tooltips a reasonable length.

If a widget provides an expanded tooltip but no normal tooltip, not even a hint is shown when hovering the widget. This way no hovering text will appear unless it was explicitly set by a developer. At the same time this lets us keep Whats This available for all areas.

An exception to this are QMenus. QActions have their text as their tooltip by default so to avoid having a tooltip that is identical to the action text already visible, only the hint for the expanded tooltip is shown for them.

This MR also adds the shortcut to tooltips of QToolButtons.

Having tooltips be expandable lets us minimise the risk of tooltips covering currently used areas of an application by accident.


  • It currently doesn't seem to work with Okular, Kate, Konsole. nvm, this worked all along. I tested it wrong.
  • Have some sort of mechanism so applications can opt out of using these tooltip changes.
  • Have some sort of mechanism so singular widgets can still handle tooltips themselves.
  • It should probably respect the setting in Workspace Behaviour which disables tooltips. nvm, that setting is only meant to apply to the "Plasma panel or [to] the desktop". Even if we wanted to change it so it applies to KDE applications as well, that should be done using QStyle::SH_ToolTip_WakeUpDelay in a style related framework so not in this MR or framework.

Test plan:

  1. Build kxmlgui with this MR
  2. Source it like usual:
  3. Start an application. No changes to the application are necessary. This should work for all applications that inherit from KMainWindow. For applications that don't have What's This texts, the only visible changes should be the added shortcut information for QToolButtons and tooltips showing up in menus if they were explicitly set.

Related discussion:

Edited by Felix Ernst

Merge request reports