Make QML tooltips consistent
Open, LowPublic

Description

There are currently varying settings and times for QML tooltips, so we need to make them consistent.
Using QML tooltips as an attached property is discouraged as they cannot inherit the default settings and times.
This is what we should use:

QQC2.ToolTip {
    ...
}
GB_2 created this task.May 1 2019, 8:29 AM
GB_2 triaged this task as Low priority.
ngraham added a subscriber: ngraham.May 1 2019, 6:20 PM

+1 for encouraging and tracking this kind of code hygiene.

If I remember correctly in D18809 there was problem I had when using this style. There two tooltips would be visible and overlap eacht other (the tooltip of the listitem and the action tooltip). So this style doesn't work everywhere

davidedmundson added a subscriber: davidedmundson.EditedMay 27 2019, 2:13 PM

Using QML tooltips as an attached property is discouraged

:/

QQuickToolTipAttached is a super light QObject that then creates the tooltip on demand, QQuickToolTip is a much heavier full QQuickPopup instance. Adding to every single button/delegate will add up significantly.

It also introduces a bug that popups can overlap

as they cannot inherit the default settings and times.

As in delay and timeout?

GB_2 added a subscriber: broulik.May 27 2019, 2:22 PM

As in delay and timeout?

Yes.

QQuickToolTipAttached is a super light QObject that then creates the tooltip on demand, QQuickToolTip is a much heavier full QQuickPopup instance. Adding to every single button/delegate will add up significantly.

Is there any way to make the attached property version inherit the delay/timeout/etc values so we can get the best of both worlds?

ngraham moved this task from To Do to Work in Progress on the Plasma board.Sep 27 2019, 3:39 PM
ngraham removed projects: Frameworks, VDG.

Is there any way to make the attached property version inherit the delay/timeout/etc values so we can get the best of both worlds?

Not in Qt5.

Options are:

  • Copy 2 lines
  • Creating some KDEImport.Tooltip which is a lot of duplication, which arguably also solves the in-window vs real tooltip issue. Plasma has one somewhere which could be moved
  • Make performance abysmal instantiating an entire dialog. Would be the hardest to migrate if we fix it in Qt6.
cblack added a subscriber: cblack.Apr 29 2020, 9:46 PM

I think the simple solution would be to just add something to the units in Kirigami and Plasma, and have coding convention to use those units.

So still have to manually set the properties everywhere but take the values from external API instead of hardcoding.

Works for me.