2019-12-19 22:46:16 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2019-07-14 10:15:20 +10:00
|
|
|
import QtQuick 2.12
|
2020-03-14 02:35:05 +11:00
|
|
|
import QtQuick.Layouts 1.12
|
2019-07-14 10:15:20 +10:00
|
|
|
|
2020-03-14 02:35:05 +11:00
|
|
|
HColumnLayout {
|
2019-07-16 19:29:47 +10:00
|
|
|
spacing: theme.spacing / 2
|
2019-07-14 10:15:20 +10:00
|
|
|
|
|
|
|
|
2020-06-03 10:14:55 +10:00
|
|
|
default property alias insideData: itemHolder.data
|
|
|
|
|
2020-06-25 22:32:08 +10:00
|
|
|
readonly property Item item: itemHolder.children[0]
|
2020-06-03 10:14:55 +10:00
|
|
|
readonly property alias label: label
|
|
|
|
readonly property alias errorLabel: errorLabel
|
|
|
|
readonly property alias toolTip: toolTip
|
2020-03-14 02:35:05 +11:00
|
|
|
|
|
|
|
|
|
|
|
HRowLayout {
|
2020-03-14 03:15:53 +11:00
|
|
|
spacing: parent.spacing
|
|
|
|
|
2020-03-14 02:35:05 +11:00
|
|
|
HLabel {
|
|
|
|
id: label
|
2020-06-03 18:50:19 +10:00
|
|
|
opacity: item.opacity
|
2020-03-14 03:15:53 +11:00
|
|
|
wrapMode: Text.Wrap
|
2020-03-14 02:35:05 +11:00
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
HIcon {
|
|
|
|
svgName: "field-tooltip-available"
|
2020-06-03 18:50:19 +10:00
|
|
|
opacity: item.opacity
|
2020-03-14 02:35:05 +11:00
|
|
|
visible: toolTip.text
|
|
|
|
|
|
|
|
Binding on colorize {
|
|
|
|
value: theme.colors.accentElement
|
|
|
|
when: hoverHandler.hovered || toolTip.visible
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HoverHandler {
|
|
|
|
id: hoverHandler
|
|
|
|
enabled: toolTip.text
|
|
|
|
}
|
|
|
|
|
|
|
|
TapHandler {
|
|
|
|
onTapped: toolTip.instantShow()
|
|
|
|
enabled: toolTip.text
|
|
|
|
}
|
|
|
|
|
|
|
|
HToolTip {
|
|
|
|
id: toolTip
|
|
|
|
visible: toolTip.text && hoverHandler.hovered
|
|
|
|
}
|
2019-07-14 10:15:20 +10:00
|
|
|
}
|
|
|
|
|
2020-06-03 10:14:55 +10:00
|
|
|
Item {
|
|
|
|
id: itemHolder
|
|
|
|
// implicitWidth: childrenRect.width
|
|
|
|
implicitHeight: childrenRect.height
|
2020-03-14 02:35:05 +11:00
|
|
|
|
|
|
|
Layout.fillWidth: true
|
2019-07-14 10:15:20 +10:00
|
|
|
}
|
2020-03-14 03:10:47 +11:00
|
|
|
|
|
|
|
HLabel {
|
|
|
|
id: errorLabel
|
2020-06-03 18:50:19 +10:00
|
|
|
opacity: item.opacity
|
2020-03-14 03:10:47 +11:00
|
|
|
visible: Layout.maximumHeight > 0
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
color: theme.colors.errorText
|
|
|
|
|
|
|
|
Layout.maximumHeight: text ? implicitHeight : 0
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
Behavior on Layout.maximumHeight { HNumberAnimation {} }
|
|
|
|
}
|
2019-07-14 10:15:20 +10:00
|
|
|
}
|