Add a rectangle surrounding the settings listview

Contributes to CURA-5941.
This commit is contained in:
Diego Prado Gesto 2018-12-03 14:43:35 +01:00
parent 4c468831f0
commit ce6a0676dd
6 changed files with 43 additions and 20 deletions

View File

@ -91,17 +91,36 @@ Item
} }
} }
Cura.SettingView Rectangle
{ {
anchors anchors
{ {
top: tabBar.visible ? tabBar.bottom : globalProfileRow.bottom top: tabBar.visible ? tabBar.bottom : globalProfileRow.bottom
topMargin: UM.Theme.getSize("default_margin").height
left: parent.left left: parent.left
leftMargin: parent.padding leftMargin: parent.padding
right: parent.right right: parent.right
rightMargin: parent.padding rightMargin: parent.padding
bottom: parent.bottom bottom: parent.bottom
topMargin: -UM.Theme.getSize("default_lining").width
bottomMargin: -UM.Theme.getSize("default_lining").width
}
z: tabBar.z - 1
// Don't show the border when only one extruder
border.color: tabBar.visible ? UM.Theme.getColor("lining") : "transparent"
border.width: UM.Theme.getSize("default_lining").width
Cura.SettingView
{
anchors
{
fill: parent
topMargin: UM.Theme.getSize("default_margin").height
leftMargin: UM.Theme.getSize("default_margin").width
// Small space for the scrollbar
rightMargin: UM.Theme.getSize("narrow_margin").width
// Compensate for the negative margin in the parent
bottomMargin: UM.Theme.getSize("default_lining").width
}
} }
} }
} }

View File

@ -12,8 +12,8 @@ Button
id: base id: base
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width // To avoid overlaping with the scrollBars
anchors.rightMargin: UM.Theme.getSize("default_margin").width * 3 anchors.rightMargin: 2 * UM.Theme.getSize("thin_margin").width
hoverEnabled: true hoverEnabled: true
background: Rectangle background: Rectangle
@ -25,22 +25,24 @@ Button
if (base.color) if (base.color)
{ {
return base.color return base.color
} else if (!base.enabled) }
else if (!base.enabled)
{ {
return UM.Theme.getColor("setting_category_disabled") return UM.Theme.getColor("setting_category_disabled")
} else if (base.hovered && base.checkable && base.checked) }
else if (base.hovered && base.checkable && base.checked)
{ {
return UM.Theme.getColor("setting_category_active_hover") return UM.Theme.getColor("setting_category_active_hover")
} else if (base.pressed || (base.checkable && base.checked)) }
else if (base.pressed || (base.checkable && base.checked))
{ {
return UM.Theme.getColor("setting_category_active") return UM.Theme.getColor("setting_category_active")
} else if (base.hovered) }
else if (base.hovered)
{ {
return UM.Theme.getColor("setting_category_hover") return UM.Theme.getColor("setting_category_hover")
} else
{
return UM.Theme.getColor("setting_category")
} }
return UM.Theme.getColor("setting_category")
} }
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
Rectangle Rectangle

View File

@ -10,8 +10,9 @@ import Cura 1.0 as Cura
import "." import "."
Item { Item
id: base; {
id: base
height: UM.Theme.getSize("section").height height: UM.Theme.getSize("section").height
@ -105,11 +106,11 @@ Item {
Label Label
{ {
id: label; id: label
anchors.left: parent.left; anchors.left: parent.left
anchors.leftMargin: doDepthIndentation ? Math.round((UM.Theme.getSize("section_icon_column").width / 1.2) + ((definition.depth - 1) * UM.Theme.getSize("setting_control_depth_margin").width)) : 0 anchors.leftMargin: doDepthIndentation ? Math.round((UM.Theme.getSize("section_icon_column").width / 1.2) + ((definition.depth - 1) * UM.Theme.getSize("setting_control_depth_margin").width)) : 0
anchors.right: settingControls.left; anchors.right: settingControls.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: definition.label text: definition.label

View File

@ -163,6 +163,7 @@ Item
top: filterContainer.top top: filterContainer.top
bottom: filterContainer.bottom bottom: filterContainer.bottom
right: parent.right right: parent.right
rightMargin: UM.Theme.getSize("wide_margin").width
} }
style: ButtonStyle style: ButtonStyle
@ -210,7 +211,7 @@ Item
ListView ListView
{ {
id: contents id: contents
spacing: Math.round(UM.Theme.getSize("default_lining").height) spacing: UM.Theme.getSize("default_lining").height
cacheBuffer: 1000000 // Set a large cache to effectively just cache every list item. cacheBuffer: 1000000 // Set a large cache to effectively just cache every list item.
model: UM.SettingDefinitionsModel model: UM.SettingDefinitionsModel

View File

@ -384,13 +384,13 @@ QtObject
{ {
implicitWidth: Theme.getSize("scrollbar").width implicitWidth: Theme.getSize("scrollbar").width
radius: Math.round(implicitWidth / 2) radius: Math.round(implicitWidth / 2)
color: Theme.getColor("scrollbar_background"); color: Theme.getColor("scrollbar_background")
} }
handle: Rectangle handle: Rectangle
{ {
id: scrollViewHandle id: scrollViewHandle
implicitWidth: Theme.getSize("scrollbar").width; implicitWidth: Theme.getSize("scrollbar").width
radius: Math.round(implicitWidth / 2) radius: Math.round(implicitWidth / 2)
color: styleData.pressed ? Theme.getColor("scrollbar_handle_down") : styleData.hovered ? Theme.getColor("scrollbar_handle_hover") : Theme.getColor("scrollbar_handle"); color: styleData.pressed ? Theme.getColor("scrollbar_handle_down") : styleData.hovered ? Theme.getColor("scrollbar_handle_hover") : Theme.getColor("scrollbar_handle");

View File

@ -411,7 +411,7 @@
"extruder_icon": [2.33, 2.33], "extruder_icon": [2.33, 2.33],
"section": [0.0, 2.2], "section": [0.0, 2],
"section_icon": [1.6, 1.6], "section_icon": [1.6, 1.6],
"section_icon_column": [2.8, 0.0], "section_icon_column": [2.8, 0.0],