Plasma

qml/Label.qml
1 /*
2  SPDX-FileCopyrightText: 2011 Marco Martin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 import QtQuick 2.1
8 import QtQuick.Window 2.2
9 import QtQuick.Controls 1.0
10 import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate
11 import org.kde.plasma.core 2.0 as PlasmaCore
12 
13 /**
14  * This is a label which uses the plasma theme.
15  *
16  * The characteristics of the text will be automatically set according to the
17  * plasma theme. If you need a more customized text item use the Text component
18  * from QtQuick.
19  *
20  * You can use all elements of the QML Text component, in particular the "text"
21  * property to define the label text.
22  *
23  * @inherit QtQuick.Text
24  */
25 Text {
26  id: root
27 
28  height: Math.round(Math.max(paintedHeight, PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height*1.6))
29  verticalAlignment: lineCount > 1 ? Text.AlignTop : Text.AlignVCenter
30 
31  activeFocusOnTab: false
32 
33  // Work around Qt bug where NativeRendering breaks for non-integer scale factors
34  // https://bugreports.qt.io/browse/QTBUG-70481
35  renderType: QtQuickControlsPrivate.Settings.isMobile || Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering
36 
37  font.capitalization: PlasmaCore.Theme.defaultFont.capitalization
38  font.family: PlasmaCore.Theme.defaultFont.family
39  font.italic: PlasmaCore.Theme.defaultFont.italic
40  font.letterSpacing: PlasmaCore.Theme.defaultFont.letterSpacing
41  font.pointSize: PlasmaCore.Theme.defaultFont.pointSize
42  font.strikeout: PlasmaCore.Theme.defaultFont.strikeout
43  font.underline: PlasmaCore.Theme.defaultFont.underline
44  font.weight: PlasmaCore.Theme.defaultFont.weight
45  font.wordSpacing: PlasmaCore.Theme.defaultFont.wordSpacing
46  color: PlasmaCore.ColorScope.textColor
47 
48  opacity: enabled? 1 : 0.6
49 
50  Accessible.role: Accessible.StaticText
51  Accessible.name: text
52 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 18 2021 22:42:31 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.