diff --git a/src/private/TabBar.qml b/src/private/TabBar.qml index 266d20e1a7dd142c64496443d665e96c5f2fb759..25914f1cbaf9e57923e4b4bc599a45436cad318b 100644 --- a/src/private/TabBar.qml +++ b/src/private/TabBar.qml @@ -75,6 +75,8 @@ FocusScope { property int tabOverlap: styleItem ? styleItem.tabOverlap : 0 property int tabBaseOverlap: styleItem ? styleItem.tabBaseOverlap : 0 + property int elide: Text.ElideRight + function tab(index) { for (var i = 0; i < tabrow.children.length; ++i) { if (tabrow.children[i].tabindex == index) { diff --git a/src/styles/Desktop/TabViewStyle.qml b/src/styles/Desktop/TabViewStyle.qml index d2ba2280fa23a22aecabab56a7015138e764b46b..aff9cc10fbb6cac05ccdeef2414e306260e5e93e 100644 --- a/src/styles/Desktop/TabViewStyle.qml +++ b/src/styles/Desktop/TabViewStyle.qml @@ -71,11 +71,12 @@ Style { } property Component tab: Item { + id: item property string tabpos: control.count === 1 ? "only" : index === 0 ? "beginning" : index === control.count - 1 ? "end" : "middle" property string selectedpos: nextSelected ? "next" : previousSelected ? "previous" : "" property int tabHSpace: __barstyle.pixelMetric("tabhspace"); property int tabVSpace: __barstyle.pixelMetric("tabvspace"); - implicitWidth: Math.max(50, textitem.width) + tabHSpace + 2 + implicitWidth: Math.max(50, styleitem.textWidth(title)) + tabHSpace + 2 implicitHeight: Math.max(styleitem.font.pixelSize + tabVSpace + 6, 0) StyleItem { @@ -89,7 +90,7 @@ Style { hints: [tabPosition, tabpos, selectedpos] selected: tab.selected - text: title + text: elidedText(title, tabbarItem.elide, width - item.tabHSpace) hover: tab.hover hasFocus: tabbarItem.activeFocus && selected anchors.margins: paintMargins