diff --git a/muse b/muse index 65edd4a8ae1a8..2bf9534f2c109 160000 --- a/muse +++ b/muse @@ -1 +1 @@ -Subproject commit 65edd4a8ae1a8040063c6f1e2acb531cabec0bfe +Subproject commit 2bf9534f2c109cc93ce6d4c348dc66bcb1f9d62e diff --git a/src/propertiespanel/qml/MuseScore/PropertiesPanel/common/PropertiesPanelTabBar.qml b/src/propertiespanel/qml/MuseScore/PropertiesPanel/common/PropertiesPanelTabBar.qml index be5a67032a0d8..328168d9a3e49 100644 --- a/src/propertiespanel/qml/MuseScore/PropertiesPanel/common/PropertiesPanelTabBar.qml +++ b/src/propertiespanel/qml/MuseScore/PropertiesPanel/common/PropertiesPanelTabBar.qml @@ -31,4 +31,39 @@ StyledTabBar { background: Item { implicitHeight: 28 } + + contentItem: Row { + spacing: root.spacing + + Repeater { + model: root.contentModel + } + } + + // Equally divided share given to overflowing tabs, or Infinity when everything fits: + readonly property real truncatedItemWidth: computeTruncatedItemWidth() + + function computeTruncatedItemWidth() { + let items = contentChildren.filter(i => i.visible) + if (items.length === 0) { + return Infinity + } + + let totalSpacing = (items.length - 1) * root.spacing + let totalContent = items.reduce((s, i) => s + i.implicitWidth, 0) + if (totalContent + totalSpacing <= root.width) { + return Infinity + } + + let share = (root.width - totalSpacing) / items.length + let prev = -1 + while (share !== prev) { + prev = share + let fittedItems = items.filter(i => i.implicitWidth < share) + let totalFittedWidth = fittedItems.reduce((s, i) => s + i.implicitWidth, 0) + share = (root.width - totalFittedWidth - totalSpacing) / (items.length - fittedItems.length) + } + return share + } + } diff --git a/src/propertiespanel/qml/MuseScore/PropertiesPanel/common/PropertiesPanelTabButton.qml b/src/propertiespanel/qml/MuseScore/PropertiesPanel/common/PropertiesPanelTabButton.qml index 38e1d40b2be51..48149ef706539 100644 --- a/src/propertiespanel/qml/MuseScore/PropertiesPanel/common/PropertiesPanelTabButton.qml +++ b/src/propertiespanel/qml/MuseScore/PropertiesPanel/common/PropertiesPanelTabButton.qml @@ -24,6 +24,7 @@ import QtQuick import Muse.UiComponents StyledTabButton { - fillWidth: true + fillWidth: false font: ui.theme.bodyBoldFont + width: tabBar ? Math.min(implicitWidth, tabBar.truncatedItemWidth) : implicitWidth }