primary tab bar: adaptive layout

This commit is contained in:
end-4
2025-06-02 17:51:22 +02:00
parent bf22194182
commit 18990c5de7
3 changed files with 12 additions and 1 deletions
@@ -14,6 +14,14 @@ ColumnLayout {
property color colBorder: Appearance?.m3colors.m3outlineVariant ?? "#C6C6D0" property color colBorder: Appearance?.m3colors.m3outlineVariant ?? "#C6C6D0"
signal currentIndexChanged(int index) signal currentIndexChanged(int index)
property bool centerTabBar: {
console.log("PARREND WIDHTH", parent.width)
parent.width > 500
}
Layout.fillWidth: !centerTabBar
Layout.alignment: Qt.AlignHCenter
implicitWidth: Math.max(tabBar.implicitWidth, 600)
TabBar { TabBar {
id: tabBar id: tabBar
Layout.fillWidth: true Layout.fillWidth: true
@@ -40,6 +48,7 @@ ColumnLayout {
selected: (index == root.externalTrackedTab) selected: (index == root.externalTrackedTab)
buttonText: modelData.name buttonText: modelData.name
buttonIcon: modelData.icon buttonIcon: modelData.icon
minimumWidth: 160
} }
} }
} }
@@ -12,10 +12,12 @@ TabButton {
id: button id: button
property string buttonText property string buttonText
property string buttonIcon property string buttonIcon
property real minimumWidth: 110
property bool selected: false property bool selected: false
property int tabContentWidth: contentItem.children[0].implicitWidth property int tabContentWidth: contentItem.children[0].implicitWidth
property int rippleDuration: 1200 property int rippleDuration: 1200
height: buttonBackground.height height: buttonBackground.height
implicitWidth: Math.max(tabContentWidth, buttonBackground.implicitWidth, minimumWidth)
property color colBackground: ColorUtils.transparentize(Appearance?.colors.colLayer1Hover, 1) || "transparent" property color colBackground: ColorUtils.transparentize(Appearance?.colors.colLayer1Hover, 1) || "transparent"
property color colBackgroundHover: Appearance?.colors.colLayer1Hover ?? "#E5DFED" property color colBackgroundHover: Appearance?.colors.colLayer1Hover ?? "#E5DFED"
+1 -1
View File
@@ -51,7 +51,7 @@ ShellRoot {
Loader { active: enableBar; sourceComponent: Bar {} } Loader { active: enableBar; sourceComponent: Bar {} }
Loader { active: enableCheatsheet; sourceComponent: Cheatsheet {} } Loader { active: enableCheatsheet; sourceComponent: Cheatsheet {} }
Loader { active: enableDock || ConfigOptions?.dock.enable; sourceComponent: Dock {} } Loader { active: (enableDock || ConfigOptions?.dock.enable); sourceComponent: Dock {} }
Loader { active: enableMediaControls; sourceComponent: MediaControls {} } Loader { active: enableMediaControls; sourceComponent: MediaControls {} }
Loader { active: enableNotificationPopup; sourceComponent: NotificationPopup {} } Loader { active: enableNotificationPopup; sourceComponent: NotificationPopup {} }
Loader { active: enableOnScreenDisplayBrightness; sourceComponent: OnScreenDisplayBrightness {} } Loader { active: enableOnScreenDisplayBrightness; sourceComponent: OnScreenDisplayBrightness {} }