diff options
Diffstat (limited to 'src/quickcontrols/fusion/ToolTip.qml')
-rw-r--r-- | src/quickcontrols/fusion/ToolTip.qml | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/quickcontrols/fusion/ToolTip.qml b/src/quickcontrols/fusion/ToolTip.qml new file mode 100644 index 0000000000..5166d2b8b6 --- /dev/null +++ b/src/quickcontrols/fusion/ToolTip.qml @@ -0,0 +1,46 @@ +// 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.impl +import QtQuick.Controls.Fusion +import QtQuick.Controls.Fusion.impl + +T.ToolTip { + id: control + + x: parent ? (parent.width - implicitWidth) / 2 : 0 + y: -implicitHeight - 3 + + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + margins: 6 + padding: 6 + + closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent + + contentItem: Text { + text: control.text + font: control.font + wrapMode: Text.Wrap + color: control.palette.toolTipText + } + + background: Rectangle { + color: control.palette.toolTipBase + border.color: control.palette.toolTipText + + Rectangle { + z: -1 + x: 1; y: 1 + width: parent.width + height: parent.height + color: control.palette.shadow + opacity: 0.5 + } + } +} |