From 8a35f83c4bc36848902fe3af66ab0de2aef70d4e Mon Sep 17 00:00:00 2001 From: Dan Leinir Turthra Jensen Date: Wed, 31 Mar 2021 14:18:49 +0100 Subject: [PATCH] Add a humanMoment unit to the various Units 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) see also https://invent.kde.org/frameworks/kirigami/-/merge_requests/268 --- src/declarativeimports/core/units.cpp | 5 +++ src/declarativeimports/core/units.h | 36 +++++++++++++++++++ .../kirigamiplasmadesktopstyle/Units.qml | 30 ++++++++++++++++ .../kirigamiplasmastyle/Units.qml | 30 ++++++++++++++++ 4 files changed, 101 insertions(+) diff --git a/src/declarativeimports/core/units.cpp b/src/declarativeimports/core/units.cpp index 821ae07d3..67683084a 100644 --- a/src/declarativeimports/core/units.cpp +++ b/src/declarativeimports/core/units.cpp @@ -268,4 +268,9 @@ int Units::veryLongDuration() const return m_longDuration * 2; } +int Units::humanMoment() const +{ + return 2000; +} + #include "moc_units.cpp" diff --git a/src/declarativeimports/core/units.h b/src/declarativeimports/core/units.h index b5022a748..dd2039c0c 100644 --- a/src/declarativeimports/core/units.h +++ b/src/declarativeimports/core/units.h @@ -131,6 +131,36 @@ class Units : public QObject */ Q_PROPERTY(int veryLongDuration READ veryLongDuration NOTIFY durationChanged) + /** + * 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) + * + * @since 5.81 + */ + Q_PROPERTY(int humanMoment READ humanMoment CONSTANT) + public: /// @cond INTERNAL_DOCS @@ -198,6 +228,12 @@ public: * @since 5.78 */ int veryShortDuration() const; + + /** + * @return Duration for very long wait times + * @since 5.81 + */ + int humanMoment() const; /// @endcond /** diff --git a/src/declarativeimports/kirigamiplasmadesktopstyle/Units.qml b/src/declarativeimports/kirigamiplasmadesktopstyle/Units.qml index f3e51b0a9..6545e62a5 100644 --- a/src/declarativeimports/kirigamiplasmadesktopstyle/Units.qml +++ b/src/declarativeimports/kirigamiplasmadesktopstyle/Units.qml @@ -117,6 +117,36 @@ QtObject { */ property int toolTipDelay: 700 + /** + * 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) + * + * @since 5.81 + */ + property int humanMoment: 2000 + /** * metrics used by the default font */ diff --git a/src/declarativeimports/kirigamiplasmastyle/Units.qml b/src/declarativeimports/kirigamiplasmastyle/Units.qml index 9538b6dde..f3092bd0d 100644 --- a/src/declarativeimports/kirigamiplasmastyle/Units.qml +++ b/src/declarativeimports/kirigamiplasmastyle/Units.qml @@ -110,6 +110,36 @@ QtObject { */ property int toolTipDelay: Settings.tabletMode ? Qt.styleHints.mousePressAndHoldInterval : 700 + /** + * 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) + * + * @since 5.81 + */ + property int humanMoment: 2000 + /** * metrics used by the default font */