Tray: fixed with vertical bar
This commit is contained in:
parent
d6d51d24c9
commit
8b6c7632af
1 changed files with 12 additions and 8 deletions
|
|
@ -18,6 +18,7 @@ Rectangle {
|
||||||
|
|
||||||
readonly property real itemSize: 24 * scaling
|
readonly property real itemSize: 24 * scaling
|
||||||
readonly property string barPosition: Settings.data.bar.position
|
readonly property string barPosition: Settings.data.bar.position
|
||||||
|
readonly property bool isVertical: barPosition === "left" || barPosition === "right"
|
||||||
|
|
||||||
function onLoaded() {
|
function onLoaded() {
|
||||||
// When the widget is fully initialized with its props
|
// When the widget is fully initialized with its props
|
||||||
|
|
@ -28,26 +29,29 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
visible: SystemTray.items.values.length > 0
|
visible: SystemTray.items.values.length > 0
|
||||||
implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : (trayLayout.implicitWidth + Style.marginM * scaling * 2)
|
// Changed: The binding now refers to 'trayFlow'
|
||||||
implicitHeight: (barPosition === "left" || barPosition === "right") ? Math.round(trayLayout.implicitHeight + Style.marginM * scaling * 2) : Math.round(Style.capsuleHeight * scaling)
|
implicitWidth: isVertical ? Math.round(Style.capsuleHeight * scaling) : (trayFlow.implicitWidth + Style.marginS * scaling * 2)
|
||||||
|
implicitHeight: isVertical ? (trayFlow.implicitHeight + Style.marginS * scaling * 2) : Math.round(Style.capsuleHeight * scaling)
|
||||||
radius: Math.round(Style.radiusM * scaling)
|
radius: Math.round(Style.radiusM * scaling)
|
||||||
color: Color.mSurfaceVariant
|
color: Color.mSurfaceVariant
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
|
||||||
RowLayout {
|
Flow {
|
||||||
id: trayLayout
|
id: trayFlow
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: Style.marginS * scaling
|
spacing: Style.marginS * scaling
|
||||||
|
|
||||||
|
// The key change: Dynamically set the flow direction
|
||||||
|
flow: isVertical ? Flow.TopToBottom : Flow.LeftToRight
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: repeater
|
id: repeater
|
||||||
model: SystemTray.items
|
model: SystemTray.items
|
||||||
|
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
Layout.preferredWidth: itemSize
|
width: itemSize
|
||||||
Layout.preferredHeight: itemSize
|
height: itemSize
|
||||||
Layout.alignment: Qt.AlignCenter
|
|
||||||
visible: modelData
|
visible: modelData
|
||||||
|
|
||||||
IconImage {
|
IconImage {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue