You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
statusbar/qml/StandardItem.qml

71 lines
1.8 KiB
QML

import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.0
import FishUI 1.0 as FishUI
import Cutefish.StatusBar 1.0
Item {
id: control
property var popupText: ""
signal clicked
signal rightClicked
MouseArea {
id: _mouseArea
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
hoverEnabled: true
onClicked: {
if (mouse.button == Qt.LeftButton)
control.clicked()
else if (mouse.button == Qt.RightButton)
control.rightClicked()
}
onPressed: {
popupTips.hide()
}
onContainsMouseChanged: {
if (containsMouse && control.popupText !== "") {
popupTips.popupText = control.popupText
popupTips.position = Qt.point(control.mapToGlobal(0, 0).x + (control.width / 2 - popupTips.width / 2),
control.height + FishUI.Units.smallSpacing)
popupTips.show()
} else {
popupTips.hide()
}
}
}
Rectangle {
anchors.fill: parent
anchors.topMargin: 1
anchors.bottomMargin: 1
radius: FishUI.Theme.smallRadius
color: {
if (_mouseArea.containsMouse) {
if (_mouseArea.containsPress)
return (FishUI.Theme.darkMode) ? Qt.rgba(255, 255, 255, 0.3) : Qt.rgba(0, 0, 0, 0.2)
else
return (FishUI.Theme.darkMode) ? Qt.rgba(255, 255, 255, 0.2) : Qt.rgba(0, 0, 0, 0.1)
}
return "transparent"
}
Behavior on color {
ColorAnimation {
duration: 125
easing.type: Easing.InOutCubic
}
}
}
}