mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 11:19:04 +08:00
Reduce component sizes
Contributes to CURA-5378
This commit is contained in:
parent
f6b43bd9ab
commit
93645e6bfe
88
resources/qml/Preferences/Materials/MaterialBrandSection.qml
Normal file
88
resources/qml/Preferences/Materials/MaterialBrandSection.qml
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
// Copyright (c) 2018 Ultimaker B.V.
|
||||||
|
// Uranium is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 1.4
|
||||||
|
import QtQuick.Controls.Styles 1.4
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
import QtQuick.Dialogs 1.2
|
||||||
|
|
||||||
|
import UM 1.2 as UM
|
||||||
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: brand_section
|
||||||
|
property var expanded: true
|
||||||
|
property var types_model: model.material_types
|
||||||
|
height: childrenRect.height
|
||||||
|
width: parent.width
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: brand_header_background
|
||||||
|
color: UM.Theme.getColor("favorites_header_bar")
|
||||||
|
anchors.fill: brand_header
|
||||||
|
}
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
id: brand_header
|
||||||
|
width: parent.width
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
id: brand_name
|
||||||
|
text: model.name
|
||||||
|
height: UM.Theme.getSize("favorites_row").height
|
||||||
|
width: parent.width - UM.Theme.getSize("favorites_button").width
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
leftPadding: 4
|
||||||
|
}
|
||||||
|
Button
|
||||||
|
{
|
||||||
|
text: ""
|
||||||
|
implicitWidth: UM.Theme.getSize("favorites_button").width
|
||||||
|
implicitHeight: UM.Theme.getSize("favorites_button").height
|
||||||
|
UM.RecolorImage {
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
width: UM.Theme.getSize("standard_arrow").width
|
||||||
|
height: UM.Theme.getSize("standard_arrow").height
|
||||||
|
sourceSize.width: width
|
||||||
|
sourceSize.height: height
|
||||||
|
color: "black"
|
||||||
|
source: brand_section.expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
||||||
|
}
|
||||||
|
style: ButtonStyle
|
||||||
|
{
|
||||||
|
background: Rectangle
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
color: "transparent"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
anchors.fill: brand_header
|
||||||
|
onPressed:
|
||||||
|
{
|
||||||
|
brand_section.expanded = !brand_section.expanded
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Column
|
||||||
|
{
|
||||||
|
anchors.top: brand_header.bottom
|
||||||
|
width: parent.width
|
||||||
|
anchors.left: parent.left
|
||||||
|
height: brand_section.expanded ? childrenRect.height : 0
|
||||||
|
visible: brand_section.expanded
|
||||||
|
Repeater
|
||||||
|
{
|
||||||
|
model: types_model
|
||||||
|
delegate: MaterialTypeSection {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
97
resources/qml/Preferences/Materials/MaterialTypeSection.qml
Normal file
97
resources/qml/Preferences/Materials/MaterialTypeSection.qml
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
// Copyright (c) 2018 Ultimaker B.V.
|
||||||
|
// Uranium is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 1.4
|
||||||
|
import QtQuick.Controls.Styles 1.4
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
import QtQuick.Dialogs 1.2
|
||||||
|
|
||||||
|
import UM 1.2 as UM
|
||||||
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: material_type_section
|
||||||
|
property var expanded: true
|
||||||
|
property var colors_model: model.colors
|
||||||
|
height: childrenRect.height
|
||||||
|
width: parent.width
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: material_type_header_background
|
||||||
|
color: UM.Theme.getColor("lining")
|
||||||
|
anchors.bottom: material_type_header.bottom
|
||||||
|
anchors.left: material_type_header.left
|
||||||
|
height: UM.Theme.getSize("default_lining").height
|
||||||
|
width: material_type_header.width
|
||||||
|
}
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
id: material_type_header
|
||||||
|
width: parent.width - 8
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: 8
|
||||||
|
}
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: model.name
|
||||||
|
height: UM.Theme.getSize("favorites_row").height
|
||||||
|
width: parent.width - UM.Theme.getSize("favorites_button").width
|
||||||
|
id: material_type_name
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
}
|
||||||
|
Button
|
||||||
|
{
|
||||||
|
text: ""
|
||||||
|
implicitWidth: UM.Theme.getSize("favorites_button").width
|
||||||
|
implicitHeight: UM.Theme.getSize("favorites_button").height
|
||||||
|
UM.RecolorImage {
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
width: UM.Theme.getSize("standard_arrow").width
|
||||||
|
height: UM.Theme.getSize("standard_arrow").height
|
||||||
|
sourceSize.width: width
|
||||||
|
sourceSize.height: height
|
||||||
|
color: "black"
|
||||||
|
source: material_type_section.expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
||||||
|
}
|
||||||
|
style: ButtonStyle
|
||||||
|
{
|
||||||
|
background: Rectangle
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
color: "transparent"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
anchors.fill: material_type_header
|
||||||
|
onPressed:
|
||||||
|
{
|
||||||
|
material_type_section.expanded = !material_type_section.expanded
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Column
|
||||||
|
{
|
||||||
|
height: material_type_section.expanded ? childrenRect.height : 0
|
||||||
|
visible: material_type_section.expanded
|
||||||
|
width: parent.width
|
||||||
|
anchors.top: material_type_header.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
Repeater
|
||||||
|
{
|
||||||
|
model: colors_model
|
||||||
|
delegate: MaterialSlot {
|
||||||
|
material: model
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -180,168 +180,8 @@ Item
|
|||||||
Repeater
|
Repeater
|
||||||
{
|
{
|
||||||
id: brand_list
|
id: brand_list
|
||||||
|
|
||||||
model: materialsModel
|
model: materialsModel
|
||||||
delegate: Rectangle
|
delegate: MaterialBrandSection {}
|
||||||
{
|
|
||||||
id: brand_section
|
|
||||||
property var expanded: true
|
|
||||||
property var types_model: model.material_types
|
|
||||||
height: childrenRect.height
|
|
||||||
width: parent.width
|
|
||||||
Rectangle
|
|
||||||
{
|
|
||||||
id: brand_header_background
|
|
||||||
color: UM.Theme.getColor("favorites_header_bar")
|
|
||||||
anchors.fill: brand_header
|
|
||||||
}
|
|
||||||
Row
|
|
||||||
{
|
|
||||||
id: brand_header
|
|
||||||
width: parent.width
|
|
||||||
Label
|
|
||||||
{
|
|
||||||
id: brand_name
|
|
||||||
text: model.name
|
|
||||||
height: UM.Theme.getSize("favorites_row").height
|
|
||||||
width: parent.width - UM.Theme.getSize("favorites_button").width
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
leftPadding: 4
|
|
||||||
}
|
|
||||||
Button
|
|
||||||
{
|
|
||||||
text: ""
|
|
||||||
implicitWidth: UM.Theme.getSize("favorites_button").width
|
|
||||||
implicitHeight: UM.Theme.getSize("favorites_button").height
|
|
||||||
UM.RecolorImage {
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
width: UM.Theme.getSize("standard_arrow").width
|
|
||||||
height: UM.Theme.getSize("standard_arrow").height
|
|
||||||
sourceSize.width: width
|
|
||||||
sourceSize.height: height
|
|
||||||
color: "black"
|
|
||||||
source: brand_section.expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
|
||||||
}
|
|
||||||
style: ButtonStyle
|
|
||||||
{
|
|
||||||
background: Rectangle
|
|
||||||
{
|
|
||||||
anchors.fill: parent
|
|
||||||
color: "transparent"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MouseArea
|
|
||||||
{
|
|
||||||
anchors.fill: brand_header
|
|
||||||
onPressed:
|
|
||||||
{
|
|
||||||
brand_section.expanded = !brand_section.expanded
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Column
|
|
||||||
{
|
|
||||||
anchors.top: brand_header.bottom
|
|
||||||
width: parent.width
|
|
||||||
anchors.left: parent.left
|
|
||||||
height: brand_section.expanded ? childrenRect.height : 0
|
|
||||||
visible: brand_section.expanded
|
|
||||||
Repeater
|
|
||||||
{
|
|
||||||
model: types_model
|
|
||||||
delegate: Rectangle
|
|
||||||
{
|
|
||||||
id: material_type_section
|
|
||||||
property var expanded: true
|
|
||||||
property var colors_model: model.colors
|
|
||||||
height: childrenRect.height
|
|
||||||
width: parent.width
|
|
||||||
Rectangle
|
|
||||||
{
|
|
||||||
id: material_type_header_background
|
|
||||||
color: UM.Theme.getColor("lining")
|
|
||||||
anchors.bottom: material_type_header.bottom
|
|
||||||
anchors.left: material_type_header.left
|
|
||||||
height: UM.Theme.getSize("default_lining").height
|
|
||||||
width: material_type_header.width
|
|
||||||
}
|
|
||||||
Row
|
|
||||||
{
|
|
||||||
id: material_type_header
|
|
||||||
width: parent.width - 8
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: 8
|
|
||||||
}
|
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: model.name
|
|
||||||
height: UM.Theme.getSize("favorites_row").height
|
|
||||||
width: parent.width - UM.Theme.getSize("favorites_button").width
|
|
||||||
id: material_type_name
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
Button
|
|
||||||
{
|
|
||||||
text: ""
|
|
||||||
implicitWidth: UM.Theme.getSize("favorites_button").width
|
|
||||||
implicitHeight: UM.Theme.getSize("favorites_button").height
|
|
||||||
UM.RecolorImage {
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
width: UM.Theme.getSize("standard_arrow").width
|
|
||||||
height: UM.Theme.getSize("standard_arrow").height
|
|
||||||
sourceSize.width: width
|
|
||||||
sourceSize.height: height
|
|
||||||
color: "black"
|
|
||||||
source: material_type_section.expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
|
||||||
}
|
|
||||||
style: ButtonStyle
|
|
||||||
{
|
|
||||||
background: Rectangle
|
|
||||||
{
|
|
||||||
anchors.fill: parent
|
|
||||||
color: "transparent"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MouseArea
|
|
||||||
{
|
|
||||||
anchors.fill: material_type_header
|
|
||||||
onPressed:
|
|
||||||
{
|
|
||||||
material_type_section.expanded = !material_type_section.expanded
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Column
|
|
||||||
{
|
|
||||||
height: material_type_section.expanded ? childrenRect.height : 0
|
|
||||||
visible: material_type_section.expanded
|
|
||||||
width: parent.width
|
|
||||||
anchors.top: material_type_header.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
Repeater
|
|
||||||
{
|
|
||||||
model: colors_model
|
|
||||||
delegate: MaterialSlot {
|
|
||||||
material: model
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user