noctalia-shell/Components/IconButton.qml
quadbyte d3be5b760b Scaling: many improvements and fixes
- radius are not pixels, they should not be scaled
- use "screen" instead of "Screen" which helps a lot in some places
2025-08-07 23:18:05 -04:00

36 lines
No EOL
927 B
QML

import QtQuick
import Quickshell
import Quickshell.Widgets
import qs.Settings
MouseArea {
id: root
property string icon
property bool enabled: true
property bool hovering: false
property real size: 32
cursorShape: Qt.PointingHandCursor
implicitWidth: size
implicitHeight: size
hoverEnabled: true
onEntered: hovering = true
onExited: hovering = false
Rectangle {
anchors.fill: parent
radius: 8
color: root.hovering ? Theme.accentPrimary : "transparent"
}
Text {
id: iconText
anchors.centerIn: parent
text: root.icon
font.family: "Material Symbols Outlined"
font.pixelSize: 24 * Theme.scale(screen)
color: root.hovering ? Theme.onAccent : Theme.textPrimary
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
opacity: root.enabled ? 1.0 : 0.5
}
}