mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-07 14:04:03 -06:00
Create a reusable component for the printer type label. Other parts of
the UI can just reuse it. Contributes to CURA-5942.
This commit is contained in:
parent
0211122b12
commit
5c30df2a68
4 changed files with 39 additions and 23 deletions
|
@ -3,7 +3,6 @@
|
|||
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.1
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import UM 1.1 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
@ -15,6 +14,7 @@ Button
|
|||
width: parent.width
|
||||
height: UM.Theme.getSize("action_button").height
|
||||
leftPadding: Math.round(1.5 * UM.Theme.getSize("default_margin").width)
|
||||
rightPadding: Math.round(1.5 * UM.Theme.getSize("default_margin").width)
|
||||
checkable: true
|
||||
|
||||
property var outputDevice: null
|
||||
|
@ -63,27 +63,9 @@ Button
|
|||
Repeater
|
||||
{
|
||||
model: printerTypesList
|
||||
delegate: Item
|
||||
delegate: Cura.PrinterTypeLabel
|
||||
{
|
||||
width: UM.Theme.getSize("printer_type_label").width
|
||||
height: UM.Theme.getSize("printer_type_label").height
|
||||
|
||||
Rectangle
|
||||
{
|
||||
anchors.fill: parent
|
||||
color: UM.Theme.getColor("printer_type_label_background")
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: printerTypeLabel
|
||||
text: modelData
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
renderType: Text.NativeRendering
|
||||
font: UM.Theme.getFont("very_small")
|
||||
color: UM.Theme.getColor("text")
|
||||
}
|
||||
text: modelData
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
34
resources/qml/PrinterSelector/PrinterTypeLabel.qml
Normal file
34
resources/qml/PrinterSelector/PrinterTypeLabel.qml
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.1
|
||||
|
||||
import UM 1.1 as UM
|
||||
|
||||
// This component creates a label with the abbreviated name of a printer, with a rectangle surrounding the label.
|
||||
// It is created in a separated place in order to be reused whenever needed.
|
||||
Item
|
||||
{
|
||||
property alias text: printerTypeLabel.text
|
||||
|
||||
width: UM.Theme.getSize("printer_type_label").width
|
||||
height: UM.Theme.getSize("printer_type_label").height
|
||||
|
||||
Rectangle
|
||||
{
|
||||
anchors.fill: parent
|
||||
color: UM.Theme.getColor("printer_type_label_background")
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: printerTypeLabel
|
||||
text: "CFFFP" // As an abbreviated name of the Custom FFF Printer
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
renderType: Text.NativeRendering
|
||||
font: UM.Theme.getFont("very_small")
|
||||
color: UM.Theme.getColor("text")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue