Prevent duplicate "Whats This?" tooltips, and prevent closing non-expandable tooltips

Merged Joshua Goins requested to merge work/redstrate/remove-duplicate-whatsthis into master

Some actions or widgets have useless "Whats This?" tooltips that are duplicated from their regular tooltips. New logic is added to hide these when detected.

I'm not familiar with KXMLGUI's codebase at all, so please see the "Tasks & Feedback" section.


Currently, some actions (and also now menu items, with !45 (merged)) have expandable tooltip text that is useless. A good example is libkdegames, which a lot of KDE games are based off of - set the "Whats This?" text of something like "New Game" with "Start a new game." with the tooltip text of "Start a new game"

Yeah, real helpful :-) We could manually patch every single place where this happens, but honestly we should just don't display them. We already work around QAction tooltips which are identical to their icon names, after all.


  • We need some way to detect whether or not tooltip text and whats this text is the same, the process is identical as hasExplicitToolTip, hence hasExplicitWhatsThis
  • We also need to track whether or not the last tooltip was expandable before interrupting key inputs (for Shift to expand the tooltip) thus m_lastToolTipWasExpandable.
  • A workaround must be applied for QToolButton items, because we explicitly set their tooltip to include the shortcut. That's why hasUniqueTooltip is set again on line 213.

Tasks and Feedback

  • Consolidate hasExplicitToolTip and hasExplicitWhatsThis because they are just duplicate functions.
  • Is there a better way to determine whether or not the last tooltip was expandable at the handleKeyPressEvent call site? I couldn't find any, and you can even see pressing shift actually closes non-whats this tooltips without this MR.
  • The first non-whats this menu tooltip you hover can still be closed. I'm not sure why, just a minor nagging bug.
Edited by Joshua Goins

Merge request reports