Theme tooltips inside popups
PillButton's attached ToolTip is now a styled instance — uses the widget's foreground color for text + border and a configurable tooltipBackground (defaults to a near-black, overridable to bar.background). No more stock OS chrome inside our popups. Bluetooth panel passes bar.background/foreground through to its header pills and replaces the row tooltip with the same themed style.
This commit is contained in:
@@ -11,6 +11,8 @@ Rectangle {
|
|||||||
property color background: "transparent"
|
property color background: "transparent"
|
||||||
property color hoverBackground: Qt.rgba(foreground.r, foreground.g, foreground.b, 0.12)
|
property color hoverBackground: Qt.rgba(foreground.r, foreground.g, foreground.b, 0.12)
|
||||||
property color pressedBackground: Qt.rgba(foreground.r, foreground.g, foreground.b, 0.22)
|
property color pressedBackground: Qt.rgba(foreground.r, foreground.g, foreground.b, 0.22)
|
||||||
|
property color tooltipBackground: "#101315"
|
||||||
|
property color tooltipForeground: foreground
|
||||||
property string fontFamily: "JetBrainsMono Nerd Font"
|
property string fontFamily: "JetBrainsMono Nerd Font"
|
||||||
property real fontSize: 12
|
property real fontSize: 12
|
||||||
property real iconSize: 14
|
property real iconSize: 14
|
||||||
@@ -19,9 +21,31 @@ Rectangle {
|
|||||||
property bool active: false
|
property bool active: false
|
||||||
property color activeBackground: Qt.rgba(foreground.r, foreground.g, foreground.b, 0.18)
|
property color activeBackground: Qt.rgba(foreground.r, foreground.g, foreground.b, 0.18)
|
||||||
|
|
||||||
ToolTip.visible: tooltipText !== "" && mouseArea.containsMouse
|
ToolTip {
|
||||||
ToolTip.text: tooltipText
|
visible: root.tooltipText !== "" && mouseArea.containsMouse
|
||||||
ToolTip.delay: 400
|
text: root.tooltipText
|
||||||
|
delay: 400
|
||||||
|
padding: 0
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
|
color: root.tooltipBackground
|
||||||
|
border.color: root.tooltipForeground
|
||||||
|
border.width: 1
|
||||||
|
radius: 0
|
||||||
|
opacity: 0.97
|
||||||
|
}
|
||||||
|
|
||||||
|
contentItem: Text {
|
||||||
|
text: root.tooltipText
|
||||||
|
color: root.tooltipForeground
|
||||||
|
font.family: root.fontFamily
|
||||||
|
font.pixelSize: 11
|
||||||
|
leftPadding: 10
|
||||||
|
rightPadding: 10
|
||||||
|
topPadding: 6
|
||||||
|
bottomPadding: 6
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
signal clicked()
|
signal clicked()
|
||||||
signal rightClicked()
|
signal rightClicked()
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ Item {
|
|||||||
iconText: ""
|
iconText: ""
|
||||||
tooltipText: !root.adapter ? "" : !root.adapter.enabled ? "Bluetooth is off"
|
tooltipText: !root.adapter ? "" : !root.adapter.enabled ? "Bluetooth is off"
|
||||||
: root.adapter.discovering ? "Stop scanning" : "Scan for devices"
|
: root.adapter.discovering ? "Stop scanning" : "Scan for devices"
|
||||||
|
tooltipBackground: root.bar.background
|
||||||
|
tooltipForeground: root.bar.foreground
|
||||||
foreground: root.bar.foreground
|
foreground: root.bar.foreground
|
||||||
horizontalPadding: 6
|
horizontalPadding: 6
|
||||||
verticalPadding: 4
|
verticalPadding: 4
|
||||||
@@ -115,6 +117,8 @@ Item {
|
|||||||
Common.PillButton {
|
Common.PillButton {
|
||||||
iconText: ""
|
iconText: ""
|
||||||
tooltipText: "Open Impala (TUI)"
|
tooltipText: "Open Impala (TUI)"
|
||||||
|
tooltipBackground: root.bar.background
|
||||||
|
tooltipForeground: root.bar.foreground
|
||||||
foreground: root.bar.foreground
|
foreground: root.bar.foreground
|
||||||
horizontalPadding: 6
|
horizontalPadding: 6
|
||||||
verticalPadding: 4
|
verticalPadding: 4
|
||||||
@@ -126,6 +130,8 @@ Item {
|
|||||||
iconText: root.adapter && root.adapter.enabled ? "" : ""
|
iconText: root.adapter && root.adapter.enabled ? "" : ""
|
||||||
text: root.adapter && root.adapter.enabled ? "On" : "Off"
|
text: root.adapter && root.adapter.enabled ? "On" : "Off"
|
||||||
tooltipText: root.adapter && root.adapter.enabled ? "Turn Bluetooth off" : "Turn Bluetooth on"
|
tooltipText: root.adapter && root.adapter.enabled ? "Turn Bluetooth off" : "Turn Bluetooth on"
|
||||||
|
tooltipBackground: root.bar.background
|
||||||
|
tooltipForeground: root.bar.foreground
|
||||||
foreground: root.bar.foreground
|
foreground: root.bar.foreground
|
||||||
horizontalPadding: 10
|
horizontalPadding: 10
|
||||||
verticalPadding: 4
|
verticalPadding: 4
|
||||||
@@ -259,14 +265,37 @@ Item {
|
|||||||
|
|
||||||
Behavior on color { ColorAnimation { duration: 120 } }
|
Behavior on color { ColorAnimation { duration: 120 } }
|
||||||
|
|
||||||
ToolTip.visible: rowMouse.containsMouse && tooltipBody !== ""
|
|
||||||
ToolTip.text: tooltipBody
|
|
||||||
ToolTip.delay: 400
|
|
||||||
readonly property string tooltipBody:
|
readonly property string tooltipBody:
|
||||||
isDiscovered ? "Click to pair and connect"
|
isDiscovered ? "Click to pair and connect"
|
||||||
: isConnected ? "Click to disconnect · right-click to forget"
|
: isConnected ? "Click to disconnect · right-click to forget"
|
||||||
: "Click to connect · right-click to forget"
|
: "Click to connect · right-click to forget"
|
||||||
|
|
||||||
|
ToolTip {
|
||||||
|
visible: rowMouse.containsMouse && row.tooltipBody !== ""
|
||||||
|
text: row.tooltipBody
|
||||||
|
delay: 400
|
||||||
|
padding: 0
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
|
color: root.bar.background
|
||||||
|
border.color: root.bar.foreground
|
||||||
|
border.width: 1
|
||||||
|
radius: 0
|
||||||
|
opacity: 0.97
|
||||||
|
}
|
||||||
|
|
||||||
|
contentItem: Text {
|
||||||
|
text: row.tooltipBody
|
||||||
|
color: root.bar.foreground
|
||||||
|
font.family: root.bar.fontFamily
|
||||||
|
font.pixelSize: 11
|
||||||
|
leftPadding: 10
|
||||||
|
rightPadding: 10
|
||||||
|
topPadding: 6
|
||||||
|
bottomPadding: 6
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: rowContent
|
id: rowContent
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
|||||||
Reference in New Issue
Block a user