mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 14:45:55 +08: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
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.1
|
import QtQuick.Controls 2.1
|
||||||
import QtQuick.Layouts 1.3
|
|
||||||
|
|
||||||
import UM 1.1 as UM
|
import UM 1.1 as UM
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.1
|
import QtQuick.Controls 2.1
|
||||||
import QtQuick.Layouts 1.3
|
|
||||||
|
|
||||||
import UM 1.1 as UM
|
import UM 1.1 as UM
|
||||||
import Cura 1.0 as Cura
|
import Cura 1.0 as Cura
|
||||||
@ -15,6 +14,7 @@ Button
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: UM.Theme.getSize("action_button").height
|
height: UM.Theme.getSize("action_button").height
|
||||||
leftPadding: Math.round(1.5 * UM.Theme.getSize("default_margin").width)
|
leftPadding: Math.round(1.5 * UM.Theme.getSize("default_margin").width)
|
||||||
|
rightPadding: Math.round(1.5 * UM.Theme.getSize("default_margin").width)
|
||||||
checkable: true
|
checkable: true
|
||||||
|
|
||||||
property var outputDevice: null
|
property var outputDevice: null
|
||||||
@ -63,27 +63,9 @@ Button
|
|||||||
Repeater
|
Repeater
|
||||||
{
|
{
|
||||||
model: printerTypesList
|
model: printerTypesList
|
||||||
delegate: Item
|
delegate: Cura.PrinterTypeLabel
|
||||||
{
|
{
|
||||||
width: UM.Theme.getSize("printer_type_label").width
|
text: modelData
|
||||||
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")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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")
|
||||||
|
}
|
||||||
|
}
|
@ -10,4 +10,5 @@ NozzleMenu 1.0 NozzleMenu.qml
|
|||||||
ActionPanelWidget 1.0 ActionPanelWidget.qml
|
ActionPanelWidget 1.0 ActionPanelWidget.qml
|
||||||
IconLabel 1.0 IconLabel.qml
|
IconLabel 1.0 IconLabel.qml
|
||||||
OutputDevicesActionButton 1.0 OutputDevicesActionButton.qml
|
OutputDevicesActionButton 1.0 OutputDevicesActionButton.qml
|
||||||
ExpandableComponent 1.0 ExpandableComponent.qml
|
ExpandableComponent 1.0 ExpandableComponent.qml
|
||||||
|
PrinterTypeLabel 1.0 PrinterTypeLabel.qml
|
Loading…
x
Reference in New Issue
Block a user