mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-23 22:29:41 +08:00

Since everything is now in Cura, using SettingItemStyle does not make a lot of sense anymore
79 lines
2.2 KiB
QML
79 lines
2.2 KiB
QML
// Copyright (c) 2015 Ultimaker B.V.
|
|
// Uranium is released under the terms of the AGPLv3 or higher.
|
|
|
|
import QtQuick 2.1
|
|
import QtQuick.Layouts 1.1
|
|
import QtQuick.Controls 1.1
|
|
import QtQuick.Controls.Styles 1.1
|
|
|
|
import UM 1.2 as UM
|
|
|
|
SettingItem
|
|
{
|
|
id: base
|
|
|
|
MouseArea
|
|
{
|
|
id: control
|
|
|
|
property bool checked:
|
|
{
|
|
if(value == "True")
|
|
{
|
|
return true;
|
|
}
|
|
else if(value == "False")
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return value;
|
|
}
|
|
}
|
|
|
|
Rectangle
|
|
{
|
|
anchors
|
|
{
|
|
top: parent.top
|
|
bottom: parent.bottom
|
|
left: parent.left
|
|
}
|
|
width: height
|
|
|
|
color:
|
|
{
|
|
if (!enabled)
|
|
{
|
|
return UM.Theme.getColor("setting_control_disabled")
|
|
}
|
|
if(base.containsMouse || base.activeFocus)
|
|
{
|
|
return UM.Theme.getColor("setting_control_highlight")
|
|
}
|
|
else
|
|
{
|
|
return UM.Theme.getColor("setting_control")
|
|
}
|
|
}
|
|
|
|
border.width: UM.Theme.getSize("default_lining").width
|
|
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control.containsMouse ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
|
|
|
|
UM.RecolorImage {
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
width: parent.width/2.5
|
|
height: parent.height/2.5
|
|
sourceSize.width: width
|
|
sourceSize.height: width
|
|
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text");
|
|
source: UM.Theme.getIcon("check")
|
|
opacity: control.checked ? 1 : 0
|
|
Behavior on opacity { NumberAnimation { duration: 100; } }
|
|
}
|
|
}
|
|
}
|
|
}
|