Remove all the signal propagation for the tooltip and allow only Cura.qml to handle them

Contributes to CURA-5941.
This commit is contained in:
Diego Prado Gesto 2018-12-02 20:32:55 +01:00
parent adabb833e0
commit 7dc3320b06
11 changed files with 28 additions and 54 deletions

View file

@ -13,10 +13,6 @@ import QtGraphicalEffects 1.0 // For the dropshadow
Item Item
{ {
id: prepareMenu id: prepareMenu
// This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it.
signal showTooltip(Item item, point location, string text)
signal hideTooltip()
UM.I18nCatalog UM.I18nCatalog
{ {

View file

@ -10,9 +10,6 @@ import Cura 1.1 as Cura
Item Item
{ {
id: previewMenu id: previewMenu
// This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it.
signal showTooltip(Item item, point location, string text)
signal hideTooltip()
property real itemHeight: height - 2 * UM.Theme.getSize("default_lining").width property real itemHeight: height - 2 * UM.Theme.getSize("default_lining").width

View file

@ -181,13 +181,6 @@ UM.MainWindow
} }
} }
Connections
{
target: stageMenu.item
onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip()
}
JobSpecs JobSpecs
{ {
id: jobSpecs id: jobSpecs
@ -280,8 +273,6 @@ UM.MainWindow
// Every time the stage is changed. // Every time the stage is changed.
property var printSetupSelector: Cura.PrintSetupSelector property var printSetupSelector: Cura.PrintSetupSelector
{ {
onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip()
width: UM.Theme.getSize("print_setup_widget").width width: UM.Theme.getSize("print_setup_widget").width
height: UM.Theme.getSize("stage_menu").height height: UM.Theme.getSize("stage_menu").height
headerCornerSide: RoundedRectangle.Direction.Right headerCornerSide: RoundedRectangle.Direction.Right

View file

@ -6,5 +6,16 @@ import QtQuick.Controls 2.0
import Cura 1.0 as Cura import Cura 1.0 as Cura
Cura.SettingView {
Item
{
id: customPrintSetup
// TODO: Hardcoded now but UX has to decide about the height of this item
height: 500
Cura.SettingView
{
anchors.fill: parent
}
} }

View file

@ -9,17 +9,13 @@ import Cura 1.0 as Cura
Cura.ExpandableComponent Cura.ExpandableComponent
{ {
id: base id: printSetupSelector
property bool hideSettings: PrintInformation.preSliced property bool hideSettings: PrintInformation.preSliced
property string enabledText: catalog.i18nc("@label:Should be short", "On") property string enabledText: catalog.i18nc("@label:Should be short", "On")
property string disabledText: catalog.i18nc("@label:Should be short", "Off") property string disabledText: catalog.i18nc("@label:Should be short", "Off")
// This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it.
signal showTooltip(Item item, point location, string text)
signal hideTooltip()
iconSource: UM.Theme.getIcon("pencil") iconSource: UM.Theme.getIcon("pencil")
popupPadding: UM.Theme.getSize("default_lining").width popupPadding: UM.Theme.getSize("default_lining").width
popupSpacingY: UM.Theme.getSize("narrow_margin").width popupSpacingY: UM.Theme.getSize("narrow_margin").width
@ -32,17 +28,6 @@ Cura.ExpandableComponent
name: "cura" name: "cura"
} }
Timer
{
id: tooltipDelayTimer
interval: 500
repeat: false
property var item
property string text
onTriggered: base.showTooltip(base, {x: 0, y: item.y}, text)
}
headerItem: PrintSetupSelectorHeader headerItem: PrintSetupSelectorHeader
{ {
anchors.fill: parent anchors.fill: parent

View file

@ -93,7 +93,7 @@ Item
Item Item
{ {
id: contents id: contents
height: childrenRect.height height: currentModeIndex == 0 ? recommendedPrintSetup.height : customPrintSetup.height
anchors anchors
{ {
@ -104,28 +104,25 @@ Item
RecommendedPrintSetup RecommendedPrintSetup
{ {
id: recommendedPrintSetup
anchors anchors
{ {
left: parent.left left: parent.left
right: parent.right right: parent.right
top: parent.top top: parent.top
} }
onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip()
visible: currentModeIndex == 0 visible: currentModeIndex == 0
} }
CustomPrintSetup CustomPrintSetup
{ {
id: customPrintSetup
anchors anchors
{ {
left: parent.left left: parent.left
right: parent.right right: parent.right
top: parent.top top: parent.top
} }
height: 500
onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip()
visible: currentModeIndex == 1 visible: currentModeIndex == 1
} }
} }

View file

@ -32,7 +32,7 @@ Item
Item Item
{ {
id: enableAdhesionContainer id: enableAdhesionContainer
height: childrenRect.height height: enableAdhesionCheckBox.height
anchors anchors
{ {
@ -46,9 +46,11 @@ Item
id: enableAdhesionCheckBox id: enableAdhesionCheckBox
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
property alias _hovered: adhesionMouseArea.containsMouse
//: Setting enable printing build-plate adhesion helper checkbox //: Setting enable printing build-plate adhesion helper checkbox
style: UM.Theme.styles.checkbox style: UM.Theme.styles.checkbox
enabled: base.settingsEnabled enabled: recommendedPrintSettup.settingsEnabled
visible: platformAdhesionType.properties.enabled == "True" visible: platformAdhesionType.properties.enabled == "True"
checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" checked: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none"
@ -58,7 +60,6 @@ Item
id: adhesionMouseArea id: adhesionMouseArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
enabled: base.settingsEnabled
onClicked: onClicked:
{ {

View file

@ -189,7 +189,7 @@ Item
text: catalog.i18nc("@label", "Gradual infill") text: catalog.i18nc("@label", "Gradual infill")
style: UM.Theme.styles.checkbox style: UM.Theme.styles.checkbox
enabled: base.settingsEnabled enabled: recommendedPrintSettup.settingsEnabled
visible: infillSteps.properties.enabled == "True" visible: infillSteps.properties.enabled == "True"
checked: parseInt(infillSteps.properties.value) > 0 checked: parseInt(infillSteps.properties.value) > 0

View file

@ -10,13 +10,10 @@ import Cura 1.0 as Cura
Item Item
{ {
id: base id: recommendedPrintSettup
height: childrenRect.height + 2 * padding height: childrenRect.height + 2 * padding
signal showTooltip(Item item, point location, string text)
signal hideTooltip()
property Action configureSettings property Action configureSettings
property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1 property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1

View file

@ -50,7 +50,7 @@ Item
property alias _hovered: enableSupportMouseArea.containsMouse property alias _hovered: enableSupportMouseArea.containsMouse
style: UM.Theme.styles.checkbox style: UM.Theme.styles.checkbox
enabled: base.settingsEnabled enabled: recommendedPrintSettup.settingsEnabled
visible: supportEnabled.properties.enabled == "True" visible: supportEnabled.properties.enabled == "True"
checked: supportEnabled.properties.value == "True" checked: supportEnabled.properties.value == "True"
@ -60,6 +60,7 @@ Item
id: enableSupportMouseArea id: enableSupportMouseArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True") onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True")
onEntered: onEntered:
@ -86,7 +87,7 @@ Item
} }
style: UM.Theme.styles.combobox_color style: UM.Theme.styles.combobox_color
enabled: base.settingsEnabled enabled: recommendedPrintSettup.settingsEnabled
visible: enableSupportCheckBox.visible && (supportEnabled.properties.value == "True") && (extrudersEnabledCount.properties.value > 1) visible: enableSupportCheckBox.visible && (supportEnabled.properties.value == "True") && (extrudersEnabledCount.properties.value > 1)
textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started textRole: "text" // this solves that the combobox isn't populated in the first time Cura is started
@ -126,7 +127,7 @@ Item
id: supportExtruderMouseArea id: supportExtruderMouseArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
enabled: base.settingsEnabled enabled: recommendedPrintSettup.settingsEnabled
acceptedButtons: Qt.NoButton acceptedButtons: Qt.NoButton
onEntered: onEntered:
{ {

View file

@ -13,13 +13,11 @@ import "../Menus"
Item Item
{ {
id: base; id: settingsView
property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel() property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel()
property Action configureSettings property Action configureSettings
property bool findingSettings property bool findingSettings
signal showTooltip(Item item, point location, string text)
signal hideTooltip()
ToolButton ToolButton
{ {
@ -359,7 +357,7 @@ Item
contextMenu.provider = provider contextMenu.provider = provider
contextMenu.popup(); contextMenu.popup();
} }
onShowTooltip: base.showTooltip(delegate, { x: -UM.Theme.getSize("default_arrow").width, y: Math.round(delegate.height / 2) }, text) onShowTooltip: base.showTooltip(delegate, Qt.point(- UM.Theme.getSize("default_arrow").width, 0), text)
onHideTooltip: base.hideTooltip() onHideTooltip: base.hideTooltip()
onShowAllHiddenInheritedSettings: onShowAllHiddenInheritedSettings:
{ {