Libplasma

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
12/**
13 * Internal type containing the default layout of a tooltip.
14 */
15Item {
16 property Item toolTip
17 property int preferredTextWidth: Kirigami.Units.gridUnit * 20
18
19 implicitWidth: mainLayout.implicitWidth + Kirigami.Units.largeSpacing * 2
20 implicitHeight: mainLayout.implicitHeight + Kirigami.Units.largeSpacing * 2
21
22 LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
23 LayoutMirroring.childrenInherit: true
24
25 Kirigami.Theme.colorSet: Kirigami.Theme.Window
26 Kirigami.Theme.inherit: false
27
28 RowLayout {
29 id: mainLayout
30 anchors.centerIn: parent
31 anchors.margins: Kirigami.Units.largeSpacing
32
33 spacing: Kirigami.Units.gridUnit
34
35 Image {
36 source: toolTip ? toolTip.image : ""
37 visible: toolTip !== null && toolTip.image !== ""
38 Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
39 }
40
41 Kirigami.Icon {
42 animated: false
43 source: toolTip ? toolTip.icon : ""
44 Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
45 visible: toolTip !== null && toolTip.icon !== "" && toolTip.image === "" && valid
46 Layout.preferredWidth: Kirigami.Units.iconSizes.medium
47 Layout.preferredHeight: Kirigami.Units.iconSizes.medium
48 }
49
50 ColumnLayout {
51 Layout.maximumWidth: preferredTextWidth
52 spacing: 0
53
54 Kirigami.Heading {
55 level: 3
56 Layout.fillWidth: true
57 elide: Text.ElideRight
58 wrapMode: Text.Wrap
59 text: toolTip ? toolTip.mainText : ""
60 textFormat: Text.PlainText
61 visible: text !== ""
62 }
63
64 PlasmaComponents.Label {
65 Layout.fillWidth: true
66 wrapMode: Text.WordWrap
67 text: toolTip ? toolTip.subText : ""
68 textFormat: toolTip ? toolTip.textFormat : Text.AutoText
69 opacity: 0.6
70 visible: text !== ""
71 maximumLineCount: 8
72 }
73 }
74 }
75}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:04:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.