Fix icon spacing
This commit is contained in:
1 parent
f9646299bf
commit
27a3feffc6
3 files changed
+15
No files matched your search
@@ -24,6 +24,8 @@ Item {
|
|||||||
property bool useActiveColor: true
|
property bool useActiveColor: true
|
||||||
property bool maintainIndicatorReveal: false
|
property bool maintainIndicatorReveal: false
|
||||||
property bool labelVisible: true
|
property bool labelVisible: true
|
||||||
|
// Off for icon-font labels, whose figure metrics say nothing about the glyph.
|
||||||
|
property bool centerFigures: true
|
||||||
property bool hasVisualContent: text !== ""
|
property bool hasVisualContent: text !== ""
|
||||||
property var revealHost: bar
|
property var revealHost: bar
|
||||||
property string tooltipText: ""
|
property string tooltipText: ""
|
||||||
@@ -77,6 +79,12 @@ Item {
|
|||||||
textFormat: Text.PlainText
|
textFormat: Text.PlainText
|
||||||
visible: root.labelVisible
|
visible: root.labelVisible
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
// Centering the line box puts the figures above the bar's middle, since
|
||||||
|
// the box keeps room for descenders. Center the figure height instead, so
|
||||||
|
// labels line up with the icons beside them.
|
||||||
|
anchors.verticalCenterOffset: !root.centerFigures || root.vertical || root.text.indexOf("\n") !== -1
|
||||||
|
? 0
|
||||||
|
: (labelMetrics.descent - labelMetrics.ascent + labelMetrics.tightBoundingRect("0").height) / 2
|
||||||
text: root.text
|
text: root.text
|
||||||
color: root.active && root.useActiveColor ? root.activeColor : root.foreground
|
color: root.active && root.useActiveColor ? root.activeColor : root.foreground
|
||||||
font.family: root.fontFamily
|
font.family: root.fontFamily
|
||||||
@@ -92,6 +100,11 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FontMetrics {
|
||||||
|
id: labelMetrics
|
||||||
|
font: label.font
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ BarWidget {
|
|||||||
bar: root.bar
|
bar: root.bar
|
||||||
text: "\ue900"
|
text: "\ue900"
|
||||||
fontFamily: "omarchy"
|
fontFamily: "omarchy"
|
||||||
|
centerFigures: false
|
||||||
horizontalMargin: 7.5
|
horizontalMargin: 7.5
|
||||||
onPressed: function(button) {
|
onPressed: function(button) {
|
||||||
if (!root.bar) return
|
if (!root.bar) return
|
||||||
|
|||||||
@@ -712,6 +712,7 @@ Panel {
|
|||||||
id: button
|
id: button
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
bar: root.bar
|
bar: root.bar
|
||||||
|
slotSize: Style.bar.statusSlot
|
||||||
text: ""
|
text: ""
|
||||||
tooltipText: "World clock"
|
tooltipText: "World clock"
|
||||||
onPressed: function(buttonCode) {
|
onPressed: function(buttonCode) {
|
||||||
|
|||||||
Reference in new issue
Block a user