org::kde::kirigami::Units

Search for usage in LXR

org::kde::kirigami::Units Class Reference

Inherits QtQuick.QtObject, QtObject, and QtObject.

Properties

real devicePixelRatio
 
variant fontMetrics
 
var fontMetrics
 
int gridUnit
 
int humanMoment
 
QtObject iconSizes
 
int largeSpacing
 
int longDuration
 
int shortDuration
 
int smallSpacing
 
int toolTipDelay
 
int veryLongDuration
 
int veryShortDuration
 
int wheelScrollLines
 

Detailed Description

A set of values to define semantically sizes and durations.

Remarks
This component is a singleton

Definition at line 14 of file controls/Units.qml.

Property Documentation

real Units::devicePixelRatio

The ratio between physical and device-independent pixels.

This value does not depend on the size of the configured font. If you want to take font sizes into account when scaling elements, use theme.mSize(theme.defaultFont), units.smallSpacing and units.largeSpacing. The devicePixelRatio follows the definition of "device independent pixel" by Microsoft.

Definition at line 57 of file controls/Units.qml.

variant org::kde::kirigami::Units::fontMetrics

metrics used by the default font

Definition at line 128 of file controls/Units.qml.

var org::kde::kirigami::Units::fontMetrics

metrics used by the default font

Definition at line 133 of file styles/org.kde.desktop/Units.qml.

int Units::gridUnit

The fundamental unit of space that should be used for sizes, expressed in pixels.

Given the screen has an accurate DPI settings, it corresponds to the height of the font's boundingRect.

Given the screen has an accurate DPI settings, it corresponds to a width of the capital letter M

Definition at line 21 of file controls/Units.qml.

int Units::humanMoment

Time in milliseconds equivalent to the theoretical human moment, which can be used to determine whether how long to wait until the user should be informed of something, or can be used as the limit for how long something should wait before being automatically initiated.

Some examples:

  • When the user types text in a search field, wait no longer than this duration after the user completes typing before starting the search
  • When loading data which would commonly arrive rapidly enough to not require interaction, wait this long before showing a spinner

This might seem an arbitrary number, but given the psychological effect that three seconds seems to be what humans consider a moment (and in the case of waiting for something to happen, a moment is that time when you think "this is taking a bit long, isn't it?"), the idea is to postpone for just before such a conceptual moment. The reason for the two seconds, rather than three, is to function as a middle ground: Not long enough that the user would think that something has taken too long, for also not so fast as to happen too soon.

See also https://www.psychologytoday.com/blog/all-about-addiction/201101/tick-tock-tick-hugs-and-life-in-3-second-intervals (the actual paper is hidden behind an academic paywall and consequently not readily available to us, so the source will have to be the blog entry above)

Note
This should not be used as an animation duration, as it is deliberately not scaled according to the animation settings. This is specifically for determining when something has taken too long and the user should expect some kind of feedback. See veryShortDuration, shortDuration, longDuration, and veryLongDuration for animation duration choices.
Since
5.81
org.kde.kirigami 2.16

Definition at line 118 of file controls/Units.qml.

QtObject Units::iconSizes

units.iconSizes provides access to platform-dependent icon sizing

The icon sizes provided are normalized for different DPI, so icons will scale depending on the DPI.

  • sizeForLabels (the largest icon size that fits within fontMetrics.height)
    Since
    5.80
    org.kde.kirigami 2.16
  • small
  • smallMedium
  • medium
  • large
  • huge
  • enormous

The icon sizes provided are normalized for different DPI, so icons will scale depending on the DPI.

Icon sizes from KIconLoader, adjusted to devicePixelRatio:

  • small
  • smallMedium
  • medium
  • large
  • huge
  • enormous

Not devicePixelRation-adjusted::

  • desktop

Definition at line 36 of file controls/Units.qml.

int Units::largeSpacing

units.largeSpacing is the amount of spacing that should be used inside bigger UI elements, for example between an icon and the corresponding text.

Internally, this size depends on the size of the default font as rendered on the screen, so it takes user-configured font size and DPI into account.

Definition at line 50 of file controls/Units.qml.

int Units::longDuration

units.longDuration should be used for longer, screen-covering animations, for opening and closing of dialogs and other "not too small" animations

Definition at line 67 of file controls/Units.qml.

int Units::shortDuration

units.shortDuration should be used for short animations, such as accentuating a UI event, hover events, etc.

Definition at line 72 of file controls/Units.qml.

int Units::smallSpacing

units.smallSpacing is the amount of spacing that should be used around smaller UI elements, for example as spacing in Columns.

Internally, this size depends on the size of the default font as rendered on the screen, so it takes user-configured font size and DPI into account.

Definition at line 43 of file controls/Units.qml.

int Units::toolTipDelay

time in ms by which the display of tooltips will be delayed.

See also
ToolTip.delay property

Definition at line 83 of file controls/Units.qml.

int Units::veryLongDuration

units.veryLongDuration should be used for specialty animations that benefit from being even longer than longDuration.

Definition at line 62 of file controls/Units.qml.

int Units::veryShortDuration

units.veryShortDuration should be used for elements that should have a hint of smoothness, but otherwise animate near instantly.

Definition at line 77 of file controls/Units.qml.

int Units::wheelScrollLines

How much the mouse scroll wheel scrolls, expressed in lines of text.

Note: this is strictly for classical mouse wheels, touchpads 2 figer scrolling won't be affected

Remarks
This property is read-only

Definition at line 124 of file controls/Units.qml.


The documentation for this class was generated from the following file:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat May 15 2021 22:38:14 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.