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