aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/material/ToolTip.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/quickcontrols/material/ToolTip.qml')
-rw-r--r--src/quickcontrols/material/ToolTip.qml50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/quickcontrols/material/ToolTip.qml b/src/quickcontrols/material/ToolTip.qml
new file mode 100644
index 0000000000..b944c23557
--- /dev/null
+++ b/src/quickcontrols/material/ToolTip.qml
@@ -0,0 +1,50 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Templates as T
+import QtQuick.Controls.Material
+
+T.ToolTip {
+ id: control
+
+ x: parent ? (parent.width - implicitWidth) / 2 : 0
+ y: -implicitHeight - 24
+
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
+
+ margins: 12
+ padding: 8
+ horizontalPadding: padding + 8
+
+ closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent
+
+ Material.theme: Material.Dark
+
+ enter: Transition {
+ // toast_enter
+ NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; easing.type: Easing.OutQuad; duration: 500 }
+ }
+
+ exit: Transition {
+ // toast_exit
+ NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.InQuad; duration: 500 }
+ }
+
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ wrapMode: Text.Wrap
+ color: control.Material.foreground
+ }
+
+ background: Rectangle {
+ implicitHeight: control.Material.tooltipHeight
+ color: control.Material.tooltipColor
+ opacity: 0.9
+ radius: 2
+ }
+}