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
{
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
{

View file

@ -10,9 +10,6 @@ import Cura 1.1 as Cura
Item
{
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

View file

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

View file

@ -6,5 +6,16 @@ import QtQuick.Controls 2.0
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
{
id: base
id: printSetupSelector
property bool hideSettings: PrintInformation.preSliced
property string enabledText: catalog.i18nc("@label:Should be short", "On")
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")
popupPadding: UM.Theme.getSize("default_lining").width
popupSpacingY: UM.Theme.getSize("narrow_margin").width
@ -32,17 +28,6 @@ Cura.ExpandableComponent
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
{
anchors.fill: parent

View file

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

View file

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

View file

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

View file

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

View file

@ -50,7 +50,7 @@ Item
property alias _hovered: enableSupportMouseArea.containsMouse
style: UM.Theme.styles.checkbox
enabled: base.settingsEnabled
enabled: recommendedPrintSettup.settingsEnabled
visible: supportEnabled.properties.enabled == "True"
checked: supportEnabled.properties.value == "True"
@ -60,6 +60,7 @@ Item
id: enableSupportMouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: supportEnabled.setPropertyValue("value", supportEnabled.properties.value != "True")
onEntered:
@ -86,7 +87,7 @@ Item
}
style: UM.Theme.styles.combobox_color
enabled: base.settingsEnabled
enabled: recommendedPrintSettup.settingsEnabled
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
@ -126,7 +127,7 @@ Item
id: supportExtruderMouseArea
anchors.fill: parent
hoverEnabled: true
enabled: base.settingsEnabled
enabled: recommendedPrintSettup.settingsEnabled
acceptedButtons: Qt.NoButton
onEntered:
{

View file

@ -13,13 +13,11 @@ import "../Menus"
Item
{
id: base;
id: settingsView
property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel()
property Action configureSettings
property bool findingSettings
signal showTooltip(Item item, point location, string text)
signal hideTooltip()
ToolButton
{
@ -359,7 +357,7 @@ Item
contextMenu.provider = provider
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()
onShowAllHiddenInheritedSettings:
{