Kirigami2

Heading.qml
1/*
2 * SPDX-FileCopyrightText: 2012 Sebastian Kügler <sebas@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7import QtQuick
8import QtQuick.Controls as QQC2
9import org.kde.kirigami as Kirigami
10
11/**
12 * @brief A heading label used for subsections of texts.
13 *
14 * The characteristics of the text will be automatically set according to the
15 * Kirigami.Theme. Use this components for section titles or headings in your UI,
16 * for example page or section titles.
17 *
18 * Example usage:
19 * @code
20 * import org.kde.kirigami as Kirigami
21 * [...]
22 * Column {
23 * Kirigami.Heading {
24 * text: "Apples in the sunlight"
25 * level: 2
26 * }
27 * [...]
28 * }
29 * @endcode
30 *
31 * The most important property is "text", which applies to the text property of
32 * Label. See the Label component from QtQuick.Controls 2 and primitive QML Text
33 * element API for additional properties, methods and signals.
34 *
35 * @inherit QtQuick.Controls.Label
36 */
37QQC2.Label {
38 id: heading
39
40 /**
41 * @brief This property holds the level of the heading, which determines its size.
42 *
43 * This property holds the level, which determines how large the header is.
44 *
45 * Acceptable values range from 1 (big) to 5 (small).
46 *
47 * default: ``1``
48 */
49 property int level: 1
50
51 /**
52 * @brief This enumeration defines heading types.
53 *
54 * This enum helps with heading visibility (making it less or more important).
55 */
56 enum Type {
57 Normal,
58 Primary,
59 Secondary
60 }
61
62 /**
63 * @brief This property holds the heading type.
64 *
65 * The type of the heading. This can be:
66 * * ``Kirigami.Heading.Type.Normal``: Create a normal heading (default)
67 * * ``Kirigami.Heading.Type.Primary``: Makes the heading more prominent. Useful
68 * when making the heading bigger is not enough.
69 * * ``Kirigami.Heading.Type.Secondary``: Makes the heading less prominent.
70 * Useful when an heading is for a less important section in an application.
71 *
72 * @property Heading::Type type
73 * @since 5.82
74 */
75 property int type: Heading.Type.Normal
76
77 font.pointSize: {
78 let factor = 1;
79 switch (heading.level) {
80 case 1:
81 factor = 1.35;
82 break;
83 case 2:
84 factor = 1.20;
85 break;
86 case 3:
87 factor = 1.15;
88 break;
89 case 4:
90 factor = 1.10;
91 break;
92 default:
93 break;
94 }
95 return Kirigami.Theme.defaultFont.pointSize * factor;
96 }
97 font.weight: type === Heading.Type.Primary ? Font.DemiBold : Font.Normal
98
99 opacity: type === Heading.Type.Secondary ? 0.7 : 1
100
101 Accessible.role: Accessible.Heading
102}
A heading label used for subsections of texts.
Definition Heading.qml:35
Type
This enumeration defines heading types.
Definition Heading.qml:52
Type type(const QSqlDatabase &db)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.