diff --git a/src/private/TabBar.qml b/src/private/TabBar.qml index 2fc7f3c980764377911e9390f807e25141d36cdf..5af3d3e2fa6bec4dd1c4530885ee7c6a5d9bc7e9 100644 --- a/src/private/TabBar.qml +++ b/src/private/TabBar.qml @@ -163,7 +163,7 @@ FocusScope { property bool previousSelected: tabView.currentIndex === index - 1 z: selected ? 1 : -index - implicitWidth: Math.min(tabloader.implicitWidth, availableWidth/tabrow.count) + 1 + implicitWidth: tabloader.implicitWidth implicitHeight: tabloader.implicitHeight onPressed: { @@ -180,6 +180,7 @@ FocusScope { property Item control: tabView property int index: tabindex + property real availableWidth: tabbar.availableWidth property QtObject tab: QtObject { readonly property alias index: tabitem.tabindex diff --git a/src/styles/Base/TabViewStyle.qml b/src/styles/Base/TabViewStyle.qml index 090a7d038dba4d62fbd7fa21c3043283aa77a6f4..dfe1e4e985927992e190a36342b34831701c90c0 100644 --- a/src/styles/Base/TabViewStyle.qml +++ b/src/styles/Base/TabViewStyle.qml @@ -134,7 +134,10 @@ Style { property Component tab: Item { scale: control.tabPosition === Qt.TopEdge ? 1 : -1 - implicitWidth: Math.round(textitem.implicitWidth + 20) + property int totalOverlap: tabOverlap * (control.count - 1) + property real maxTabWidth: (availableWidth + totalOverlap) / control.count + + implicitWidth: Math.round(Math.min(maxTabWidth, textitem.implicitWidth + 20)) implicitHeight: Math.round(textitem.implicitHeight + 10) clip: true diff --git a/src/styles/Desktop/TabViewStyle.qml b/src/styles/Desktop/TabViewStyle.qml index ccf7e2b9d5303e24c22f9c27cc21dcdbaffd136b..75c41223c4c51bdd782a353aae72d893a8349158 100644 --- a/src/styles/Desktop/TabViewStyle.qml +++ b/src/styles/Desktop/TabViewStyle.qml @@ -73,7 +73,9 @@ Style { property string orientation: control.tabPosition === Qt.TopEdge ? "Top" : "Bottom" property int tabHSpace: __barstyle.pixelMetric("tabhspace"); property int tabVSpace: __barstyle.pixelMetric("tabvspace"); - implicitWidth: Math.max(50, styleitem.textWidth(tab.title)) + tabHSpace + 2 + property int totalOverlap: tabOverlap * (control.count - 1) + property real maxTabWidth: (control.width + totalOverlap) / control.count + implicitWidth: Math.min(maxTabWidth, Math.max(50, styleitem.textWidth(tab.title)) + tabHSpace + 2) implicitHeight: Math.max(styleitem.font.pixelSize + tabVSpace + 6, 0) StyleItem {