mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-02 16:54:23 +08:00
Move ColorDialog
to Cura repo
Move component to the Cura repo as `Cura.SecondaryButton` and `Cura.PrimaryButton` are used. CURA 8687
This commit is contained in:
parent
9bad66b6ce
commit
fca6ef29ae
63
resources/qml/ColorDialog.qml
Normal file
63
resources/qml/ColorDialog.qml
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import QtQuick 2.10
|
||||||
|
import QtQuick.Controls 2.2
|
||||||
|
import QtQuick.Window 2.1
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
|
import UM 1.5 as UM
|
||||||
|
import Cura 1.1 as Cura
|
||||||
|
|
||||||
|
UM.Dialog
|
||||||
|
{
|
||||||
|
id: base
|
||||||
|
|
||||||
|
minimumHeight: UM.Theme.getSize("small_popup_dialog").height
|
||||||
|
minimumWidth: UM.Theme.getSize("small_popup_dialog").width / 1.5
|
||||||
|
height: minimumHeight
|
||||||
|
width: minimumWidth
|
||||||
|
|
||||||
|
property alias color: colorInput.text
|
||||||
|
|
||||||
|
margin: UM.Theme.getSize("default_margin").width
|
||||||
|
buttonSpacing: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
|
UM.Label
|
||||||
|
{
|
||||||
|
id: colorLabel
|
||||||
|
font: UM.Theme.getFont("large")
|
||||||
|
text: "Color Code (HEX)"
|
||||||
|
}
|
||||||
|
|
||||||
|
TextField
|
||||||
|
{
|
||||||
|
id: colorInput
|
||||||
|
text: "#FFFFFF"
|
||||||
|
anchors.top: colorLabel.bottom
|
||||||
|
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||||
|
validator: RegExpValidator { regExp: /^#([a-fA-F0-9]{6})$/ }
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: swatch
|
||||||
|
color: base.color
|
||||||
|
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
anchors {
|
||||||
|
left: colorInput.right
|
||||||
|
top: colorInput.top
|
||||||
|
bottom: colorInput.bottom
|
||||||
|
}
|
||||||
|
width: height
|
||||||
|
}
|
||||||
|
|
||||||
|
rightButtons:
|
||||||
|
[
|
||||||
|
Cura.PrimaryButton {
|
||||||
|
text: catalog.i18nc("@action:button", "OK")
|
||||||
|
onClicked: base.accept()
|
||||||
|
},
|
||||||
|
Cura.SecondaryButton {
|
||||||
|
text: catalog.i18nc("@action:button", "Cancel")
|
||||||
|
onClicked: base.close()
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -217,7 +217,7 @@ Item
|
|||||||
|
|
||||||
// popup dialog to select a new color
|
// popup dialog to select a new color
|
||||||
// if successful it sets the properties.color_code value to the new color
|
// if successful it sets the properties.color_code value to the new color
|
||||||
UM.ColorDialog
|
Cura.ColorDialog
|
||||||
{
|
{
|
||||||
id: colorDialog
|
id: colorDialog
|
||||||
color: properties.color_code
|
color: properties.color_code
|
||||||
|
Loading…
x
Reference in New Issue
Block a user