Warning, /education/kstars/kstars/kstarslite/qml/modules/helpers/Units.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.4 0008 import QtQuick.Controls.Private 1.0 0009 import QtQuick.Window 2.2 0010 0011 QtObject { 0012 id: units 0013 0014 /** 0015 * The fundamental unit of space that should be used for sizes, expressed in pixels. 0016 * Given the screen has an accurate DPI settings, it corresponds to a width of 0017 * the capital letter M 0018 */ 0019 property int gridUnit: fontMetrics.height 0020 0021 /** 0022 * units.iconSizes provides access to platform-dependent icon sizing 0023 * 0024 * The icon sizes provided are normalized for different DPI, so icons 0025 * will scale depending on the DPI. 0026 * 0027 * Icon sizes from KIconLoader, adjusted to devicePixelRatio: 0028 * * small 0029 * * smallMedium 0030 * * medium 0031 * * large 0032 * * huge 0033 * * enormous 0034 * 0035 * Not devicePixelRation-adjusted:: 0036 * * desktop 0037 */ 0038 /*property QtObject iconSizes: QtObject { 0039 property int small: 16 * devicePixelRatio * (Settings.isMobile ? 1.5 : 1) 0040 property int smallMedium: 22 * devicePixelRatio * (Settings.isMobile ? 1.5 : 1) 0041 property int medium: 32 * devicePixelRatio * (Settings.isMobile ? 1.5 : 1) 0042 property int large: 48 * devicePixelRatio * (Settings.isMobile ? 1.5 : 1) 0043 property int huge: 64 * devicePixelRatio * (Settings.isMobile ? 1.5 : 1) 0044 property int enormous: 128 * devicePixelRatio * (Settings.isMobile ? 1.5 : 1) 0045 }*/ 0046 0047 /** 0048 * units.smallSpacing is the amount of spacing that should be used around smaller UI elements, 0049 * for example as spacing in Columns. Internally, this size depends on the size of 0050 * the default font as rendered on the screen, so it takes user-configured font size and DPI 0051 * into account. 0052 */ 0053 property int smallSpacing: gridUnit/4 0054 0055 /** 0056 * units.largeSpacing is the amount of spacing that should be used inside bigger UI elements, 0057 * for example between an icon and the corresponding text. Internally, this size depends on 0058 * the size of the default font as rendered on the screen, so it takes user-configured font 0059 * size and DPI into account. 0060 */ 0061 property int largeSpacing: gridUnit 0062 0063 /** 0064 * The ratio between physical and device-independent pixels. This value does not depend on the 0065 * size of the configured font. If you want to take font sizes into account when scaling elements, 0066 * use theme.mSize(theme.defaultFont), units.smallSpacing and units.largeSpacing. 0067 * The devicePixelRatio follows the definition of "device independent pixel" by Microsoft. 0068 */ 0069 property real devicePixelRatio: fontMetrics.font.pixelSize / (fontMetrics.font.pointSize * 1.33) 0070 0071 /** 0072 * units.longDuration should be used for longer, screen-covering animations, for opening and 0073 * closing of dialogs and other "not too small" animations 0074 */ 0075 property int longDuration: 250 0076 0077 /** 0078 * units.shortDuration should be used for short animations, such as accentuating a UI event, 0079 * hover events, etc. 0080 */ 0081 property int shortDuration: 150 0082 0083 /** 0084 * metrics used by the default font 0085 */ 0086 property variant fontMetrics: TextMetrics { 0087 text: "M" 0088 } 0089 }