Bar#
import Yasb.Bar · inherits BarBase
A layout with three slots: left, center and right, or top, center and bottom on a bar at the left or right
edge. Each slot shows the widgets listed under its name in config.yaml, in a row along the bar. Widgets in the left slot
are aligned to its start, the center slot to its middle, and the right slot to its end.
Everything from BarBase applies, such as color, radius, padding and spacing.
Guide: Layouts
Example#
YASB's floating.qml, a bar with rounded corners and a border all around:
// %USERPROFILE%\.config\yasb\layouts\floating.qml
import Yasb.Bar
Bar {
color: theme.bar.background
border.width: 1
border.color: theme.bar.border
radius: 8
padding: 12
spacing: 12
}
YASB's bar.qml also draws on the bar: a line on the side facing away from the screen edge, placed on background:
// %USERPROFILE%\.config\yasb\layouts\bar.qml
import QtQuick
import Yasb.Bar
Bar {
id: bar
color: theme.bar.background
radius: 0
padding: 12
spacing: 12
// A line along the side away from the screen: under a bar at the top, over a bar at the bottom
Rectangle {
parent: bar.background
anchors.left: parent.left
anchors.right: parent.right
anchors.top: bar.edge === "bottom" ? parent.top : undefined
anchors.bottom: bar.edge === "bottom" ? undefined : parent.bottom
height: 1
color: bar.border.color
}
}
config.yaml lists the widgets under left, center and right, or top, center and bottom.
Bar#
Properties#
leftSlot, centerSlot, rightSlot : WidgetSlot read-only#
The three slots, each a WidgetSlot, so you can set stretch or spacing on one of them.
topSlot is the same slot as leftSlot, and bottomSlot the same as rightSlot.
Slot lengths#
A slot whose stretch is false is as long as its widgets. The others share the rest of the bar equally, in whole
pixels, but none gets shorter than its widgets.
Bar has no functions or signals for layouts.