Kstars

Units.qml
1/*
2 SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7import QtQuick 2.4
8import QtQuick.Controls.Private 1.0
9import QtQuick.Window 2.2
10
11QtObject {
12 id: units
13
14 /**
15 * The fundamental unit of space that should be used for sizes, expressed in pixels.
16 * Given the screen has an accurate DPI settings, it corresponds to a width of
17 * the capital letter M
18 */
19 property int gridUnit: fontMetrics.height
20
21 /**
22 * units.iconSizes provides access to platform-dependent icon sizing
23 *
24 * The icon sizes provided are normalized for different DPI, so icons
25 * will scale depending on the DPI.
26 *
27 * Icon sizes from KIconLoader, adjusted to devicePixelRatio:
28 * * small
29 * * smallMedium
30 * * medium
31 * * large
32 * * huge
33 * * enormous
34 *
35 * Not devicePixelRation-adjusted::
36 * * desktop
37 */
38 /*property QtObject iconSizes: QtObject {
39 property int small: 16 * devicePixelRatio * (Settings.isMobile ? 1.5 : 1)
40 property int smallMedium: 22 * devicePixelRatio * (Settings.isMobile ? 1.5 : 1)
41 property int medium: 32 * devicePixelRatio * (Settings.isMobile ? 1.5 : 1)
42 property int large: 48 * devicePixelRatio * (Settings.isMobile ? 1.5 : 1)
43 property int huge: 64 * devicePixelRatio * (Settings.isMobile ? 1.5 : 1)
44 property int enormous: 128 * devicePixelRatio * (Settings.isMobile ? 1.5 : 1)
45 }*/
46
47 /**
48 * units.smallSpacing is the amount of spacing that should be used around smaller UI elements,
49 * for example as spacing in Columns. Internally, this size depends on the size of
50 * the default font as rendered on the screen, so it takes user-configured font size and DPI
51 * into account.
52 */
53 property int smallSpacing: gridUnit/4
54
55 /**
56 * units.largeSpacing is the amount of spacing that should be used inside bigger UI elements,
57 * for example between an icon and the corresponding text. Internally, this size depends on
58 * the size of the default font as rendered on the screen, so it takes user-configured font
59 * size and DPI into account.
60 */
61 property int largeSpacing: gridUnit
62
63 /**
64 * The ratio between physical and device-independent pixels. This value does not depend on the
65 * size of the configured font. If you want to take font sizes into account when scaling elements,
66 * use theme.mSize(theme.defaultFont), units.smallSpacing and units.largeSpacing.
67 * The devicePixelRatio follows the definition of "device independent pixel" by Microsoft.
68 */
69 property real devicePixelRatio: fontMetrics.font.pixelSize / (fontMetrics.font.pointSize * 1.33)
70
71 /**
72 * units.longDuration should be used for longer, screen-covering animations, for opening and
73 * closing of dialogs and other "not too small" animations
74 */
75 property int longDuration: 250
76
77 /**
78 * units.shortDuration should be used for short animations, such as accentuating a UI event,
79 * hover events, etc.
80 */
81 property int shortDuration: 150
82
83 /**
84 * metrics used by the default font
85 */
86 property variant fontMetrics: TextMetrics {
87 text: "M"
88 }
89}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:53:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.