2020-08-21 11:23:47 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
2020-09-17 15:08:02 +00:00
|
|
|
import "../../imports"
|
2020-09-17 19:45:57 +00:00
|
|
|
import "../../shared"
|
2020-08-21 11:23:47 +00:00
|
|
|
|
|
|
|
ToolTip {
|
|
|
|
id: tooltip
|
2021-02-10 16:32:45 +00:00
|
|
|
property int maxWidth: 800
|
2021-03-25 17:37:25 +00:00
|
|
|
property string orientation: "top"
|
|
|
|
|
2021-02-10 16:25:54 +00:00
|
|
|
implicitWidth: Math.min(maxWidth, textContent.implicitWidth + Style.current.bigPadding)
|
2021-02-10 00:17:09 +00:00
|
|
|
leftPadding: Style.current.smallPadding
|
|
|
|
rightPadding: Style.current.smallPadding
|
2020-08-21 11:23:47 +00:00
|
|
|
topPadding: Style.current.smallPadding
|
|
|
|
bottomPadding: Style.current.smallPadding
|
|
|
|
delay: 200
|
|
|
|
background: Item {
|
|
|
|
id: tooltipBg
|
|
|
|
Rectangle {
|
|
|
|
id: tooltipContentBg
|
2021-01-19 15:26:34 +00:00
|
|
|
color: Style.current.tooltipBackgroundColor
|
2020-08-21 11:23:47 +00:00
|
|
|
radius: Style.current.radius
|
|
|
|
anchors.fill: parent
|
2021-02-10 00:17:09 +00:00
|
|
|
anchors.bottomMargin: Style.current.smallPadding
|
2020-08-21 11:23:47 +00:00
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
color: tooltipContentBg.color
|
2021-03-25 17:37:25 +00:00
|
|
|
height: orientation === "top" || orientation === "bottom" ? 24 : 24
|
|
|
|
width: orientation === "top" || orientation === "bottom" ? 24 : 24
|
|
|
|
rotation: 45
|
2020-08-21 11:23:47 +00:00
|
|
|
radius: 1
|
2021-03-25 17:37:25 +00:00
|
|
|
x: {
|
|
|
|
if (orientation === "top" || orientation === "bottom") {
|
|
|
|
return tooltipBg.width / 2 - width / 2
|
|
|
|
}
|
|
|
|
if (orientation === "left") {
|
|
|
|
return tooltipContentBg.width - (width / 2) - 4
|
|
|
|
}
|
|
|
|
if (orientation === "right") {
|
|
|
|
return -width/2 + 4
|
|
|
|
}
|
|
|
|
}
|
|
|
|
y: {
|
|
|
|
if (orientation === "bottom") {
|
|
|
|
return -height / 2
|
|
|
|
}
|
|
|
|
if (orientation === "top") {
|
|
|
|
return tooltipBg.height - height
|
|
|
|
}
|
|
|
|
if (orientation === "left" || orientation === "right") {
|
|
|
|
return tooltipContentBg.height / 2 - (height / 2)
|
|
|
|
}
|
|
|
|
}
|
2020-08-21 11:23:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
contentItem: StyledText {
|
|
|
|
id: textContent
|
|
|
|
text: tooltip.text
|
2021-01-19 15:26:34 +00:00
|
|
|
color: Style.current.tooltipForegroundColor
|
2020-08-21 11:23:47 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
font.pixelSize: 13
|
2021-01-25 20:50:42 +00:00
|
|
|
font.weight: Font.Medium
|
2020-08-21 11:23:47 +00:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2021-02-10 00:17:09 +00:00
|
|
|
bottomPadding: Style.current.smallPadding
|
2020-08-21 11:23:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|