Kirigami2

SelectableLabel.qml
1/*
2 * SPDX-FileCopyrightText: 2022 Fushan Wen <qydwhotmail@gmail.com>
3 * SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk>
4 *
5 * SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7
8import QtQuick
9import QtQuick.Controls as QQC2
10
11/**
12 * @brief This is a label which supports text selection.
13 *
14 * You can use all elements of the QML TextArea component, in particular
15 * the "text" property to define the label text.
16 *
17 * Example usage:
18 * @code{.qml}
19 * Kirigami.SelectableLabel {
20 * text: "Label"
21 * }
22 * @endcode
23 *
24 * @see https://bugreports.qt.io/browse/QTBUG-14077
25 * @since 5.95
26 * @since org.kde.kirigami 2.20
27 * @inherit QtQuick.Controls.TextArea
28 */
29QQC2.TextArea {
30 id: root
31
32 /**
33 * @brief This property holds the cursor shape that will appear whenever
34 * the mouse is hovering over the label.
35 *
36 * default: @c Qt.IBeamCursor
37 *
38 * @property Qt::CursorShape cursorShape
39 */
40 property alias cursorShape: hoverHandler.cursorShape
41
42 padding: 0
43 topPadding: undefined
44 leftPadding: undefined
45 rightPadding: undefined
46 bottomPadding: undefined
47
48 activeFocusOnTab: false
49 readOnly: true
50 wrapMode: TextEdit.WordWrap
51 textFormat: TextEdit.AutoText
52 verticalAlignment: TextEdit.AlignTop
53
54 Accessible.selectableText: true
55 Accessible.editable: false
56
57 background: Item {}
58
59 HoverHandler {
60 id: hoverHandler
61 // By default HoverHandler accepts the left button while it shouldn't accept anything,
62 // causing https://bugreports.qt.io/browse/QTBUG-106489.
63 // Qt.NoButton unfortunately is not a valid value for acceptedButtons.
64 // Disabling masks the problem, but
65 // there is no proper workaround other than an upstream fix
66 // See qqc2-desktop-style Label.qml
67 enabled: false
68 cursorShape: root.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
69 }
70}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 12 2024 12:00:02 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.