TaskBar: implemented vertical mode
This commit is contained in:
parent
47ef62beb3
commit
937675ebb3
1 changed files with 18 additions and 7 deletions
|
|
@ -1,5 +1,3 @@
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
@ -16,17 +14,30 @@ Rectangle {
|
||||||
property real scaling: 1.0
|
property real scaling: 1.0
|
||||||
|
|
||||||
readonly property real itemSize: Style.capsuleHeight * 0.8 * scaling
|
readonly property real itemSize: Style.capsuleHeight * 0.8 * scaling
|
||||||
|
readonly property bool isVerticalBar: Settings.data.bar.position === "left" || Settings.data.bar.position === "right"
|
||||||
|
|
||||||
// Always visible when there are toplevels
|
// Always visible when there are toplevels
|
||||||
implicitWidth: taskbarLayout.implicitWidth + Style.marginM * scaling * 2
|
implicitWidth: isVerticalBar ? Math.round(Style.capsuleHeight * scaling) : taskbarLayout.implicitWidth + Style.marginM * scaling * 2
|
||||||
implicitHeight: Math.round(Style.capsuleHeight * scaling)
|
implicitHeight: isVerticalBar ? taskbarLayout.implicitHeight + Style.marginM * 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
|
||||||
|
|
||||||
RowLayout {
|
GridLayout {
|
||||||
id: taskbarLayout
|
id: taskbarLayout
|
||||||
anchors.centerIn: parent
|
anchors.fill: parent
|
||||||
spacing: Style.marginXXS * root.scaling
|
anchors {
|
||||||
|
leftMargin: isVerticalBar ? undefined : Style.marginM * scaling
|
||||||
|
rightMargin: isVerticalBar ? undefined : Style.marginM * scaling
|
||||||
|
topMargin: isVerticalBar ? Style.marginM * scaling : undefined
|
||||||
|
bottomMargin: isVerticalBar ? Style.marginM * scaling : undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configure GridLayout to behave like RowLayout or ColumnLayout
|
||||||
|
rows: isVerticalBar ? -1 : 1 // -1 means unlimited
|
||||||
|
columns: isVerticalBar ? 1 : -1 // -1 means unlimited
|
||||||
|
|
||||||
|
rowSpacing: isVerticalBar ? Style.marginXXS * root.scaling : 0
|
||||||
|
columnSpacing: isVerticalBar ? 0 : Style.marginXXS * root.scaling
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: ToplevelManager && ToplevelManager.toplevels ? ToplevelManager.toplevels : []
|
model: ToplevelManager && ToplevelManager.toplevels ? ToplevelManager.toplevels : []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue