From e23baffd43e1a98a26f1a2d6af5a2894f32e0c92 Mon Sep 17 00:00:00 2001 From: reionwong Date: Thu, 4 Nov 2021 10:07:58 +0800 Subject: [PATCH] Adjust tabbar ui --- src/controls/TabBar.qml | 4 +++- src/controls/TabButton.qml | 4 ++++ src/controls/Units.qml | 2 +- src/controls/Window.qml | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/controls/TabBar.qml b/src/controls/TabBar.qml index 9b4e3bd..9475086 100644 --- a/src/controls/TabBar.qml +++ b/src/controls/TabBar.qml @@ -70,7 +70,9 @@ TabBar { visible: active asynchronous: true - Layout.fillHeight: true + // Layout.fillHeight: true + Layout.alignment: Qt.AlignVCenter + Layout.preferredHeight: 31 Layout.preferredWidth: visible ? height : 0 sourceComponent: FishUI.RoundImageButton { diff --git a/src/controls/TabButton.qml b/src/controls/TabButton.qml index c9b3563..83a5ccf 100644 --- a/src/controls/TabButton.qml +++ b/src/controls/TabButton.qml @@ -15,6 +15,8 @@ Item { property alias font: _label.font property string text: "" + property var contentWidth: _contentLayout.implicitWidth + FishUI.Units.largeSpacing * 2 + property var backgroundColor: FishUI.Theme.secondBackgroundColor property var hoveredColor: FishUI.Theme.darkMode ? Qt.lighter(FishUI.Theme.secondBackgroundColor, 1.3) : Qt.darker(FishUI.Theme.secondBackgroundColor, 1.05) @@ -67,6 +69,7 @@ Item { } RowLayout { + id: _contentLayout anchors.fill: parent anchors.leftMargin: FishUI.Units.smallSpacing anchors.rightMargin: FishUI.Units.smallSpacing @@ -89,6 +92,7 @@ Item { } FishUI.TabCloseButton { + id: _closeButton enabled: control.checked Layout.preferredHeight: 24 Layout.preferredWidth: 24 diff --git a/src/controls/Units.qml b/src/controls/Units.qml index e1cf7d5..1ffe638 100644 --- a/src/controls/Units.qml +++ b/src/controls/Units.qml @@ -89,4 +89,4 @@ QtObject { } } } -} \ No newline at end of file +} diff --git a/src/controls/Window.qml b/src/controls/Window.qml index 0d0e630..95a8664 100644 --- a/src/controls/Window.qml +++ b/src/controls/Window.qml @@ -285,6 +285,7 @@ Window { RowLayout { spacing: FishUI.Units.smallSpacing + Layout.alignment: Qt.AlignTop // Window buttons RoundImageButton {