Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,39 @@ StyledTabBar {

background: Item {
implicitHeight: 28

SeparatorLine {
id: underlineStroke
anchors.bottom: parent.bottom
}
}

// Equally divided share given to overflowing tabs, or Infinity when everything fits:
readonly property real truncatedItemWidth: {
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 availableWidth = Math.max(0, root.width - totalSpacing)
let share = availableWidth / 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)
let remaining = items.length - fittedItems.length
share = remaining > 0
? Math.max(0, (root.width - totalFittedWidth - totalSpacing) / remaining)
: 0
}
return share
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ import QtQuick
import Muse.UiComponents

StyledTabButton {
fillWidth: true
required property real maxWidth

font: ui.theme.bodyBoldFont
width: Math.min(implicitWidth, maxWidth)
leftPadding: 4
rightPadding: 4
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Column {

PropertiesPanelTabButton {
text: qsTrc("propertiespanel", "Chords")
maxWidth: tabBar.truncatedItemWidth

navigation.name: "ChordsTab"
navigation.panel: root.navigationPanel
Expand All @@ -64,6 +65,7 @@ Column {

PropertiesPanelTabButton {
text: qsTrc("propertiespanel", "Frame")
maxWidth: tabBar.truncatedItemWidth

navigation.name: "FrameTab"
navigation.panel: root.navigationPanel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Column {

PropertiesPanelTabButton {
text: qsTrc("propertiespanel", "General")
maxWidth: tabBar.truncatedItemWidth

navigation.name: "GeneralTab"
navigation.panel: root.navigationPanel
Expand All @@ -56,6 +57,7 @@ Column {

PropertiesPanelTabButton {
text: qsTrc("propertiespanel", "Settings")
maxWidth: tabBar.truncatedItemWidth

navigation.name: "SettingsTab"
navigation.panel: root.navigationPanel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Column {

PropertiesPanelTabButton {
text: qsTrc("propertiespanel", "Position")
maxWidth: tabBar.truncatedItemWidth

navigation.name: "PositionTab"
navigation.panel: root.navigationPanel
Expand All @@ -59,6 +60,7 @@ Column {

PropertiesPanelTabButton {
text: qsTrc("propertiespanel", "Style")
maxWidth: tabBar.truncatedItemWidth

navigation.name: "StyleTab"
navigation.panel: root.navigationPanel
Expand All @@ -67,6 +69,7 @@ Column {

PropertiesPanelTabButton {
text: qsTrc("propertiespanel", "Text")
maxWidth: tabBar.truncatedItemWidth

navigation.name: "TextTab"
navigation.panel: root.navigationPanel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,26 @@ Column {
id: tabBar

PropertiesPanelTabButton {
text: qsTrc("propertiespanel", "Position")
text: "A long truncated title" // qsTrc("propertiespanel", "Position")
maxWidth: tabBar.truncatedItemWidth

navigation.name: "PositionTab"
navigation.panel: root.navigationPanel
navigation.row: root.navigationRowStart
}

PropertiesPanelTabButton {
text: qsTrc("propertiespanel", "Style")
text: "Short" // qsTrc("propertiespanel", "Style")
maxWidth: tabBar.truncatedItemWidth

navigation.name: "StyleTab"
navigation.panel: root.navigationPanel
navigation.row: root.navigationRowStart + 1
}

PropertiesPanelTabButton {
text: qsTrc("propertiespanel", "Text")
text: "Another long title" // qsTrc("propertiespanel", "Text")
maxWidth: tabBar.truncatedItemWidth

navigation.name: "TextTab"
navigation.panel: root.navigationPanel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Column {

PropertiesPanelTabButton {
text: qsTrc("propertiespanel", "Style")
maxWidth: tabBar.truncatedItemWidth

navigation.name: "StyleTab"
navigation.panel: root.navigationPanel
Expand All @@ -61,6 +62,7 @@ Column {

PropertiesPanelTabButton {
text: qsTrc("propertiespanel", "Text")
maxWidth: tabBar.truncatedItemWidth

navigation.name: "TextTab"
navigation.panel: root.navigationPanel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ Column {
}

PropertiesPanelTabButton {
text: root.headModel?.title ?? ""
text: "Cabeza" //root.headModel?.title ?? ""
maxWidth: tabBar.truncatedItemWidth

navigation.name: "HeadTab"
navigation.panel: root.navigationPanel
Expand All @@ -78,7 +79,8 @@ Column {

PropertiesPanelTabButton {
visible: root.headModel ? !root.headModel.isTrillCueNote : true
text: root.stemModel ? root.stemModel.title : ""
text: "Plica" // root.stemModel ? root.stemModel.title : ""
maxWidth: tabBar.truncatedItemWidth

navigation.name: "StemTab"
navigation.panel: root.navigationPanel
Expand All @@ -87,7 +89,8 @@ Column {

PropertiesPanelTabButton {
visible: root.headModel ? !root.headModel.isTrillCueNote : true
text: root.beamModel ? root.beamModel.title : ""
text: "Barra de agrupación but with a longer title" // root.beamModel ? root.beamModel.title : ""
maxWidth: tabBar.truncatedItemWidth

navigation.name: "BeamTab"
navigation.panel: root.navigationPanel
Expand Down
Loading