Plasma

DefaultToolTip.qml
1 /*
2  SPDX-FileCopyrightText: 2013-2015 Sebastian K├╝gler <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 import QtQuick 2.0
8 import QtQuick.Layouts 1.1
9 import org.kde.plasma.core 2.0 as PlasmaCore
10 import org.kde.plasma.components 2.0 as PlasmaComponents
11 import org.kde.plasma.extras 2.0 as PlasmaExtras
12 
13 
14 PlasmaCore.ColorScope {
15  id: tooltipContentItem
16 
17  property Item toolTip
18  property int preferredTextWidth: PlasmaCore.Units.gridUnit * 20
19 
20  Layout.minimumWidth: childrenRect.width + PlasmaCore.Units.gridUnit
21  Layout.minimumHeight: childrenRect.height + PlasmaCore.Units.gridUnit
22  Layout.maximumWidth: childrenRect.width + PlasmaCore.Units.gridUnit
23  Layout.maximumHeight: childrenRect.height + PlasmaCore.Units.gridUnit
24 
25  LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
26  LayoutMirroring.childrenInherit: true
27  colorGroup: PlasmaCore.Theme.NormalColorGroup
28  inherit: false
29 
30  RowLayout {
31 
32  anchors {
33  left: parent.left
34  top: parent.top
35  margins: PlasmaCore.Units.gridUnit / 2
36  }
37 
38  spacing: PlasmaCore.Units.largeSpacing
39 
40  Image {
41  id: tooltipImage
42  source: toolTip ? toolTip.image : ""
43  visible: toolTip != null && toolTip.image != ""
44  Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
45  }
46 
47  PlasmaCore.IconItem {
48  id: tooltipIcon
49  animated: false
50  source: toolTip ? toolTip.icon : ""
51  Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
52  visible: toolTip != null && toolTip.icon != "" && toolTip.image == "" && valid
53  Layout.preferredWidth: PlasmaCore.Units.iconSizes.medium
54  Layout.preferredHeight: PlasmaCore.Units.iconSizes.medium
55  }
56 
57  ColumnLayout {
58  Layout.maximumWidth: preferredTextWidth
59  spacing: 0
60 
61  PlasmaExtras.Heading {
62  id: tooltipMaintext
63  level: 3
64  Layout.fillWidth: true
65  elide: Text.ElideRight
66  wrapMode: Text.Wrap
67  text: toolTip ? toolTip.mainText : ""
68  textFormat: Text.PlainText
69  visible: text != ""
70  }
71  PlasmaComponents.Label {
72  id: tooltipSubtext
73  Layout.fillWidth: true
74  // Unset Label default height, confuses the layout engine completely
75  // either shifting the item vertically or letting it get too wide
76  height: undefined
77  wrapMode: Text.WordWrap
78  text: toolTip ? toolTip.subText : ""
79  textFormat: toolTip ? toolTip.textFormat : Text.AutoText
80  opacity: 0.6
81  visible: text != ""
82  maximumLineCount: 8
83  }
84  }
85  }
86 }
87 
qreal opacity() const const
qreal height() const const
QTextStream & left(QTextStream &stream)
QRectF childrenRect()
QStringView level(QStringView ifopt)
qreal width() const const
qreal height() const const
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 18 2021 22:42:30 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.