diff options
Diffstat (limited to 'src/quickcontrols/basic/ToolTip.qml')
-rw-r--r-- | src/quickcontrols/basic/ToolTip.qml | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/quickcontrols/basic/ToolTip.qml b/src/quickcontrols/basic/ToolTip.qml new file mode 100644 index 0000000000..6d71f55db3 --- /dev/null +++ b/src/quickcontrols/basic/ToolTip.qml @@ -0,0 +1,35 @@ +// 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.Controls.impl +import QtQuick.Templates as T + +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 { + border.color: control.palette.dark + color: control.palette.toolTipBase + } +} |