Cura/resources/qml/PrintSetupSelector/Recommended/RecommendedSettingSection.qml
Joey de l'Arago 1224f076c3 Fix switch alignment
CURA-9793
2022-11-29 17:20:34 +01:00

85 lines
No EOL
2.5 KiB
QML

// Copyright (c) 2022 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 2.10
import UM 1.6 as UM
import Cura 1.7 as Cura
Item
{
property alias title: sectionTitle.text
property alias icon: sectionTitle.source
property alias enableSectionVisible: enableSectionSwitch.visible
property alias enableSectionChecked: enableSectionSwitch.checked
property alias enableSectionEnabled: enableSectionSwitch.enabled
property var enableSectionClicked: { return }
property int leftColumnWidth: Math.floor(width * 0.35)
property var toolTipText: ""
property alias contents: settingColumn.children
function onEnableSectionChanged(state) {}
height: childrenRect.height
Item
{
id: sectionHeader
anchors.top: parent.top
anchors.right: parent.right
anchors.left: parent.left
height: UM.Theme.getSize("section_header").height
Cura.IconWithText
{
id: sectionTitle
width: leftColumnWidth
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: - UM.Theme.getSize("thick_lining").width
source: UM.Theme.getIcon("PrintQuality")
spacing: UM.Theme.getSize("thick_margin").width
iconSize: UM.Theme.getSize("medium_button_icon").width
iconColor: UM.Theme.getColor("text")
font: UM.Theme.getFont("medium_bold")
}
MouseArea
{
id: tooltipMouseArea
anchors.fill: sectionTitle
propagateComposedEvents: true
hoverEnabled: true
onEntered: { print("showTooltip") }
onExited: { print("hideTooltip" ) }
}
}
UM.Switch
{
id: enableSectionSwitch
anchors.left: parent.left
// These numbers come from the IconWithText in RecommendedSettingSection.
anchors.leftMargin: leftColumnWidth + UM.Theme.getSize("medium_button_icon").width + UM.Theme.getSize("thick_margin").width - (2 * UM.Theme.getSize("thick_lining").width)
anchors.verticalCenter: sectionHeader.verticalCenter
visible: false
onClicked: onEnableSectionChanged(enableSectionSwitch.checked)
}
ColumnLayout
{
id: settingColumn
width: parent.width
height: childrenRect.height
anchors.left: parent.left
anchors.right: parent.right
anchors.top: sectionHeader.bottom
}
}