mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-30 08:22:51 -05:00
Add tooltips
This commit is contained in:
@@ -561,10 +561,14 @@ DankModal {
|
|||||||
|
|
||||||
// Dank logo
|
// Dank logo
|
||||||
Item {
|
Item {
|
||||||
width: 68
|
id: dankButton
|
||||||
height: 16
|
width: 66
|
||||||
|
height: 14
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
property bool hovered: false
|
||||||
|
property string tooltipText: "DankMaterialShell GitHub"
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: Qt.resolvedUrl(".").toString().replace(
|
source: Qt.resolvedUrl(".").toString().replace(
|
||||||
@@ -585,6 +589,9 @@ DankModal {
|
|||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
hoverEnabled: true
|
||||||
|
onEntered: parent.hovered = true
|
||||||
|
onExited: parent.hovered = false
|
||||||
onClicked: Qt.openUrlExternally(
|
onClicked: Qt.openUrlExternally(
|
||||||
"https://github.com/AvengeMedia/DankMaterialShell")
|
"https://github.com/AvengeMedia/DankMaterialShell")
|
||||||
}
|
}
|
||||||
@@ -605,10 +612,14 @@ DankModal {
|
|||||||
|
|
||||||
// Niri logo
|
// Niri logo
|
||||||
Item {
|
Item {
|
||||||
|
id: niriButton
|
||||||
width: 24
|
width: 24
|
||||||
height: 24
|
height: 24
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
property bool hovered: false
|
||||||
|
property string tooltipText: "niri GitHub"
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: Qt.resolvedUrl(".").toString().replace(
|
source: Qt.resolvedUrl(".").toString().replace(
|
||||||
@@ -623,6 +634,9 @@ DankModal {
|
|||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
hoverEnabled: true
|
||||||
|
onEntered: parent.hovered = true
|
||||||
|
onExited: parent.hovered = false
|
||||||
onClicked: Qt.openUrlExternally(
|
onClicked: Qt.openUrlExternally(
|
||||||
"https://github.com/YaLTeR/niri")
|
"https://github.com/YaLTeR/niri")
|
||||||
}
|
}
|
||||||
@@ -649,10 +663,14 @@ DankModal {
|
|||||||
|
|
||||||
// Matrix button
|
// Matrix button
|
||||||
Item {
|
Item {
|
||||||
|
id: matrixButton
|
||||||
width: 38
|
width: 38
|
||||||
height: 26
|
height: 26
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
property bool hovered: false
|
||||||
|
property string tooltipText: "niri Matrix Chat"
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: Qt.resolvedUrl(".").toString().replace(
|
source: Qt.resolvedUrl(".").toString().replace(
|
||||||
@@ -673,6 +691,9 @@ DankModal {
|
|||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
hoverEnabled: true
|
||||||
|
onEntered: parent.hovered = true
|
||||||
|
onExited: parent.hovered = false
|
||||||
onClicked: Qt.openUrlExternally(
|
onClicked: Qt.openUrlExternally(
|
||||||
"https://matrix.to/#/#niri:matrix.org")
|
"https://matrix.to/#/#niri:matrix.org")
|
||||||
}
|
}
|
||||||
@@ -699,10 +720,14 @@ DankModal {
|
|||||||
|
|
||||||
// Discord button
|
// Discord button
|
||||||
Item {
|
Item {
|
||||||
|
id: discordButton
|
||||||
width: 16
|
width: 16
|
||||||
height: 16
|
height: 16
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
property bool hovered: false
|
||||||
|
property string tooltipText: "niri Discord Server"
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: Qt.resolvedUrl(".").toString().replace(
|
source: Qt.resolvedUrl(".").toString().replace(
|
||||||
@@ -717,6 +742,9 @@ DankModal {
|
|||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
hoverEnabled: true
|
||||||
|
onEntered: parent.hovered = true
|
||||||
|
onExited: parent.hovered = false
|
||||||
onClicked: Qt.openUrlExternally(
|
onClicked: Qt.openUrlExternally(
|
||||||
"https://discord.gg/vT8Sfjy7sx")
|
"https://discord.gg/vT8Sfjy7sx")
|
||||||
}
|
}
|
||||||
@@ -743,10 +771,14 @@ DankModal {
|
|||||||
|
|
||||||
// Reddit button
|
// Reddit button
|
||||||
Item {
|
Item {
|
||||||
|
id: redditButton
|
||||||
width: 18
|
width: 18
|
||||||
height: 18
|
height: 18
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
property bool hovered: false
|
||||||
|
property string tooltipText: "r/niri Subreddit"
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: Qt.resolvedUrl(".").toString().replace(
|
source: Qt.resolvedUrl(".").toString().replace(
|
||||||
@@ -761,12 +793,62 @@ DankModal {
|
|||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
hoverEnabled: true
|
||||||
|
onEntered: parent.hovered = true
|
||||||
|
onExited: parent.hovered = false
|
||||||
onClicked: Qt.openUrlExternally(
|
onClicked: Qt.openUrlExternally(
|
||||||
"https://reddit.com/r/niri")
|
"https://reddit.com/r/niri")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Footer tooltip
|
||||||
|
Rectangle {
|
||||||
|
id: footerTooltip
|
||||||
|
|
||||||
|
property var hoveredButton: {
|
||||||
|
if (dankButton.hovered) return dankButton
|
||||||
|
if (niriButton.hovered) return niriButton
|
||||||
|
if (matrixButton.hovered) return matrixButton
|
||||||
|
if (discordButton.hovered) return discordButton
|
||||||
|
if (redditButton.hovered) return redditButton
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
property string tooltipText: hoveredButton ? hoveredButton.tooltipText : ""
|
||||||
|
|
||||||
|
visible: hoveredButton !== null && tooltipText !== ""
|
||||||
|
width: tooltipLabel.implicitWidth + 24
|
||||||
|
height: tooltipLabel.implicitHeight + 12
|
||||||
|
|
||||||
|
color: Theme.surfaceContainer
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
border.width: 1
|
||||||
|
border.color: Theme.outlineMedium
|
||||||
|
|
||||||
|
x: hoveredButton ? hoveredButton.mapToItem(
|
||||||
|
parent, hoveredButton.width / 2,
|
||||||
|
0).x - width / 2 : 0
|
||||||
|
y: hoveredButton ? hoveredButton.mapToItem(
|
||||||
|
parent, 0, -height - 8).y : 0
|
||||||
|
|
||||||
|
layer.enabled: true
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
shadowEnabled: true
|
||||||
|
shadowOpacity: 0.15
|
||||||
|
shadowVerticalOffset: 2
|
||||||
|
shadowBlur: 0.5
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: tooltipLabel
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: footerTooltip.tooltipText
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user