Use UM.TabRow instead of a tab view

This styles it for us automatically.
However the contents of the tab disappears now. I'll have to restore that, but since that moves a bunch of code I'd rather do that in a separate commit.
I also changed the item to a column so that we don't have to link up the anchors very weirdly/difficulty with all of the buttons and messages that are optional. This just automatically makes space if there need to be extra buttons and messages in between, and even deals with the spacing correctly.

Contributes to issue CURA-8686.
This commit is contained in:
Ghostkeeper 2022-01-25 12:09:59 +01:00
parent 5f101e8233
commit 50960ce5cf
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A

View File

@ -519,9 +519,11 @@ Item
right: parent.right right: parent.right
} }
Item Column
{ {
anchors.fill: parent anchors.fill: parent
spacing: UM.Theme.getSize("default_margin").height
visible: base.currentItem != null visible: base.currentItem != null
Item // Profile title Label Item // Profile title Label
@ -545,11 +547,9 @@ Item
Flow Flow
{ {
id: currentSettingsActions id: currentSettingsActions
width: parent.width
visible: base.hasCurrentItem && base.currentItem.name == Cura.MachineManager.activeQualityOrQualityChangesName && base.currentItem.intent_category == Cura.MachineManager.activeIntentCategory visible: base.hasCurrentItem && base.currentItem.name == Cura.MachineManager.activeQualityOrQualityChangesName && base.currentItem.intent_category == Cura.MachineManager.activeIntentCategory
anchors.left: parent.left
anchors.right: parent.right
anchors.top: profileName.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height
Button Button
{ {
@ -566,58 +566,37 @@ Item
} }
} }
Column Label
{ {
id: profileNotices id: defaultsMessage
anchors.top: currentSettingsActions.visible ? currentSettingsActions.bottom : currentSettingsActions.anchors.top visible: false
anchors.topMargin: UM.Theme.getSize("default_margin").height text: catalog.i18nc("@action:label", "This profile uses the defaults specified by the printer, so it has no settings/overrides in the list below.")
anchors.left: parent.left wrapMode: Text.WordWrap
anchors.right: parent.right width: parent.width
spacing: UM.Theme.getSize("default_margin").height }
Label
Label {
{ id: noCurrentSettingsMessage
id: defaultsMessage visible: base.isCurrentItemActivated && !Cura.MachineManager.hasUserSettings
visible: false text: catalog.i18nc("@action:label", "Your current settings match the selected profile.")
text: catalog.i18nc("@action:label", "This profile uses the defaults specified by the printer, so it has no settings/overrides in the list below.") wrapMode: Text.WordWrap
wrapMode: Text.WordWrap width: parent.width
width: parent.width
}
Label
{
id: noCurrentSettingsMessage
visible: base.isCurrentItemActivated && !Cura.MachineManager.hasUserSettings
text: catalog.i18nc("@action:label", "Your current settings match the selected profile.")
wrapMode: Text.WordWrap
width: parent.width
}
} }
OldControls.TabView UM.TabRow
{ {
anchors.left: parent.left UM.TabRowButton //One extra tab for the global settings.
anchors.top: profileNotices.visible ? profileNotices.bottom : profileNotices.anchors.top
anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.right: parent.right
anchors.bottom: parent.bottom
currentIndex: 0
ProfileTab
{ {
title: catalog.i18nc("@title:tab", "Global Settings") text: catalog.i18nc("@title:tab", "Global Settings")
qualityItem: base.currentItem
} }
Repeater Repeater
{ {
model: base.extrudersModel model: base.extrudersModel
ProfileTab UM.TabRowButton
{ {
title: model.name text: model.name
extruderPosition: model.index
qualityItem: base.currentItem
} }
} }
} }