Warning, /frameworks/kirigami/src/controls/SelectableLabel.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-FileCopyrightText: 2022 Fushan Wen <qydwhotmail@gmail.com>
0003  *  SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk>
0004  *
0005  *  SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 import QtQuick
0009 import QtQuick.Controls as QQC2
0010 
0011 /**
0012  * @brief This is a label which supports text selection.
0013  *
0014  * You can use all elements of the QML TextArea component, in particular
0015  * the "text" property to define the label text.
0016  *
0017  * Example usage:
0018  * @code{.qml}
0019  *     Kirigami.SelectableLabel {
0020  *         text: "Label"
0021  *     }
0022  * @endcode
0023  *
0024  * @see https://bugreports.qt.io/browse/QTBUG-14077
0025  * @since 5.95
0026  * @since org.kde.kirigami 2.20
0027  * @inherit QtQuick.Controls.TextArea
0028  */
0029 QQC2.TextArea {
0030     id: selectableLabel
0031 
0032     /**
0033      * @brief This property holds the cursor shape that will appear whenever
0034      * the mouse is hovering over the label.
0035      *
0036      * default: @c Qt.IBeamCursor
0037      *
0038      * @property Qt::CursorShape cursorShape
0039      */
0040     property alias cursorShape: hoverHandler.cursorShape
0041 
0042     padding: 0
0043     topPadding: undefined
0044     leftPadding: undefined
0045     rightPadding: undefined
0046     bottomPadding: undefined
0047 
0048     activeFocusOnTab: false
0049     readOnly: true
0050     wrapMode: TextEdit.WordWrap
0051     textFormat: TextEdit.AutoText
0052     verticalAlignment: TextEdit.AlignTop
0053 
0054     Accessible.selectableText: true
0055     Accessible.editable: false
0056 
0057     background: Item {}
0058 
0059     HoverHandler {
0060         id: hoverHandler
0061         // By default HoverHandler accepts the left button while it shouldn't accept anything,
0062         // causing https://bugreports.qt.io/browse/QTBUG-106489.
0063         // Qt.NoButton unfortunately is not a valid value for acceptedButtons.
0064         // Disabling masks the problem, but
0065         // there is no proper workaround other than an upstream fix
0066         // See qqc2-desktop-style Label.qml
0067         enabled: false
0068         cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
0069     }
0070 }