mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-08 14:34:01 -06:00
Add a legend to Layer View
This commit is contained in:
parent
f0333e2184
commit
878ccc679c
4 changed files with 107 additions and 0 deletions
|
@ -306,6 +306,18 @@ UM.MainWindow
|
|||
}
|
||||
}
|
||||
|
||||
Legend
|
||||
{
|
||||
id: legend
|
||||
anchors
|
||||
{
|
||||
top: parent.top
|
||||
topMargin: UM.Theme.getSize("default_margin").height
|
||||
right: sidebar.left
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
}
|
||||
|
||||
JobSpecs
|
||||
{
|
||||
id: jobSpecs
|
||||
|
|
66
resources/qml/Legend.qml
Normal file
66
resources/qml/Legend.qml
Normal file
|
@ -0,0 +1,66 @@
|
|||
// Copyright (c) 2015 Ultimaker B.V.
|
||||
// Cura is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.1 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Rectangle {
|
||||
id: base
|
||||
|
||||
UM.I18nCatalog { id: catalog; name:"cura"}
|
||||
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
color: "transparent"
|
||||
|
||||
Connections
|
||||
{
|
||||
target: Printer
|
||||
onViewLegendItemsChanged:
|
||||
{
|
||||
legendItemRepeater.model = items
|
||||
}
|
||||
}
|
||||
|
||||
Column
|
||||
{
|
||||
Repeater
|
||||
{
|
||||
id: legendItemRepeater
|
||||
|
||||
Item {
|
||||
anchors.right: parent.right
|
||||
height: childrenRect.height
|
||||
width: childrenRect.width
|
||||
|
||||
Rectangle {
|
||||
id: swatch
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: label.verticalCenter
|
||||
height: UM.Theme.getSize("setting_control").height / 2
|
||||
width: height
|
||||
|
||||
color: modelData.color
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: UM.Theme.getColor("text_subtext")
|
||||
}
|
||||
Label {
|
||||
id: label
|
||||
|
||||
text: modelData.title
|
||||
font: UM.Theme.getFont("small")
|
||||
color: UM.Theme.getColor("text_subtext")
|
||||
|
||||
anchors.right: swatch.left
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue