Plasma-framework

DefaultToolTip.qml
1/*
2 SPDX-FileCopyrightText: 2013-2015 Sebastian Kügler <sebas@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7import QtQuick
8import QtQuick.Layouts
9import org.kde.plasma.components as PlasmaComponents
10import org.kde.kirigami as Kirigami
11
12Item {
13 property Item toolTip
14 property int preferredTextWidth: Kirigami.Units.gridUnit * 20
15
16 implicitWidth: mainLayout.implicitWidth + Kirigami.Units.largeSpacing * 2
17 implicitHeight: mainLayout.implicitHeight + Kirigami.Units.largeSpacing * 2
18
19 LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
20 LayoutMirroring.childrenInherit: true
21
22 Kirigami.Theme.colorSet: Kirigami.Theme.Window
23 Kirigami.Theme.inherit: false
24
25 RowLayout {
26 id: mainLayout
27 anchors.centerIn: parent
28 anchors.margins: Kirigami.Units.largeSpacing
29
30 spacing: Kirigami.Units.gridUnit
31
32 Image {
33 source: toolTip ? toolTip.image : ""
34 visible: toolTip !== null && toolTip.image !== ""
35 Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
36 }
37
38 Kirigami.Icon {
39 animated: false
40 source: toolTip ? toolTip.icon : ""
41 Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
42 visible: toolTip !== null && toolTip.icon !== "" && toolTip.image === "" && valid
43 Layout.preferredWidth: Kirigami.Units.iconSizes.medium
44 Layout.preferredHeight: Kirigami.Units.iconSizes.medium
45 }
46
47 ColumnLayout {
48 Layout.maximumWidth: preferredTextWidth
49 spacing: 0
50
51 Kirigami.Heading {
52 level: 3
53 Layout.fillWidth: true
54 elide: Text.ElideRight
55 wrapMode: Text.Wrap
56 text: toolTip ? toolTip.mainText : ""
57 textFormat: Text.PlainText
58 visible: text !== ""
59 }
60
61 PlasmaComponents.Label {
62 Layout.fillWidth: true
63 wrapMode: Text.WordWrap
64 text: toolTip ? toolTip.subText : ""
65 textFormat: toolTip ? toolTip.textFormat : Text.AutoText
66 opacity: 0.6
67 visible: text !== ""
68 maximumLineCount: 8
69 }
70 }
71 }
72}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:54:11 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.