Skip to content

RFC: Automatically add tooltips for icon-only things

Automatically add tooltips for icon-only things

Currently we make icons-only buttons in a mishmash of ways, and sometimes forget to manually add tooltips to them. A better approach is to have the style add them automatically using the text: property to get the text, and use the display: property to denote that it should be an icons-only button that needs a tooltip. This will let us get rid of loads of custom code in our UI controls and ensure that tooltips are always present.

Upsides of this approach:

  • We standardize on a single supported method of making a button icons-only, reducing code errors.
  • Icons-only buttons implemented using the standard get tooltips added automatically, reducing boilerplate and increasing the percentage of icons-only buttons that have these things defined (as they all should).
  • With all buttons having both text and an icon defined, it becomes feasible in the future to make QtQuick buttons respect the global button style setting, which currently only affects QtWidgets buttons.

Downsides of this approach:

  • Tooltips get lost if a different QQC2 style is ever used to style Plasma in the future. It essentially locks us to just this one, and requires that all future QQC2 styles for Plasma implement this logic as well.

If this approach is agreed upon, I plan to submit a similar change for QQC2-desktop-style and breeze-desktop-style.

To test, apply plasma-desktop!1024 (closed) and hover over the icons-only buttons in Kickoff and see that they still have tooltips.

@accessibility @ndavis @mart

Edited by Nate Graham

Merge request reports