Revision control
Copy as Markdown
// Copyright (C) 2026 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
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Templates as T
import Qt.labs.StyleKit
import Qt.labs.StyleKit.impl
T.ToolTip {
id: control
x: parent ? (parent.width - implicitWidth) / 2 : 0
y: -implicitHeight - 3
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
leftPadding: styleReader.leftPadding
rightPadding: styleReader.rightPadding
topPadding: styleReader.topPadding
bottomPadding: styleReader.bottomPadding
leftInset: styleReader.background.leftMargin
rightInset: styleReader.background.rightMargin
topInset: styleReader.background.topMargin
bottomInset: styleReader.background.bottomMargin
spacing: styleReader.spacing
font: styleReader.font
StyleVariation.controlType: styleReader.controlType
StyleReader {
id: styleReader
controlType: StyleReader.ToolTip
enabled: control.enabled
focused: control.activeFocus
palette: control.palette
}
closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent
contentItem: Text {
text: control.text
font: control.font
wrapMode: Text.Wrap
color: styleReader.text.color
padding: styleReader.text.padding
leftPadding: styleReader.text.leftPadding
rightPadding: styleReader.text.rightPadding
bottomPadding: styleReader.text.bottomPadding
topPadding: styleReader.text.topPadding
verticalAlignment: styleReader.text.alignment
horizontalAlignment: styleReader.text.alignment
}
background: BackgroundDelegate {
quickControl: control
backgroundStyle: styleReader.background
}
}