Fix width of content in tabbed content

Contributes to issue CURA-5876.
This commit is contained in:
Ghostkeeper 2018-11-26 16:03:40 +01:00
parent ac5f79ba2c
commit 4b897ffd67
No known key found for this signature in database
GPG Key ID: 86BEF881AE2CF276

View File

@ -59,7 +59,6 @@ Item
Rectangle Rectangle
{ {
id: tabControl
width: parent.width width: parent.width
height: childrenRect.height height: childrenRect.height
anchors.top: tabBar.bottom anchors.top: tabBar.bottom
@ -91,14 +90,18 @@ Item
} }
} }
property var model: extrudersModel.items[tabBar.currentIndex]
property real textWidth: Math.round(width * 0.3)
property real controlWidth: width - textWidth
Column Column
{ {
id: selectors
padding: UM.Theme.getSize("default_margin").width padding: UM.Theme.getSize("default_margin").width
spacing: UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("default_margin").height
property var model: extrudersModel.items[tabBar.currentIndex]
readonly property real paddedWidth: parent.width - padding * 2
property real textWidth: Math.round(paddedWidth * 0.3)
property real controlWidth: paddedWidth - textWidth
Row Row
{ {
height: UM.Theme.getSize("print_setup_item").height height: UM.Theme.getSize("print_setup_item").height
@ -110,13 +113,13 @@ Item
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
height: parent.height height: parent.height
width: tabControl.textWidth width: selectors.textWidth
} }
OldControls.CheckBox OldControls.CheckBox
{ {
checked: tabControl.model != null ? Cura.MachineManager.getExtruder(tabControl.model.index).isEnabled: false checked: selectors.model != null ? Cura.MachineManager.getExtruder(selectors.model.index).isEnabled: false
onClicked: Cura.MachineManager.setExtruderEnabled(tabControl.model.index, checked) onClicked: Cura.MachineManager.setExtruderEnabled(selectors.model.index, checked)
height: UM.Theme.getSize("setting_control").height height: UM.Theme.getSize("setting_control").height
style: UM.Theme.styles.checkbox style: UM.Theme.styles.checkbox
} }
@ -132,7 +135,7 @@ Item
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
height: parent.height height: parent.height
width: tabControl.textWidth width: selectors.textWidth
} }
OldControls.ToolButton OldControls.ToolButton
@ -152,7 +155,7 @@ Item
enabled: Cura.ExtruderManager.activeExtruderIndex > -1 enabled: Cura.ExtruderManager.activeExtruderIndex > -1
height: UM.Theme.getSize("setting_control").height height: UM.Theme.getSize("setting_control").height
width: tabControl.controlWidth width: selectors.controlWidth
style: UM.Theme.styles.sidebar_header_button style: UM.Theme.styles.sidebar_header_button
activeFocusOnPress: true activeFocusOnPress: true
@ -174,7 +177,7 @@ Item
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
height: parent.height height: parent.height
width: tabControl.textWidth width: selectors.textWidth
} }
OldControls.ToolButton OldControls.ToolButton
@ -185,7 +188,7 @@ Item
visible: Cura.MachineManager.hasVariants visible: Cura.MachineManager.hasVariants
height: UM.Theme.getSize("setting_control").height height: UM.Theme.getSize("setting_control").height
width: tabControl.controlWidth width: selectors.controlWidth
style: UM.Theme.styles.sidebar_header_button style: UM.Theme.styles.sidebar_header_button
activeFocusOnPress: true; activeFocusOnPress: true;