Fix QML warnings due to depricated on<signal> calls in Connections

As of 5.12, the signals used in connections should not be declared as on<signal>, but as
function on<signal>(arguments).
This commit is contained in:
Kostas Karmas 2021-03-30 08:46:14 +02:00
parent a277adae64
commit 7827b36ab7
46 changed files with 113 additions and 122 deletions

View file

@ -27,7 +27,7 @@ Cura.MachineAction
Connections
{
target: extrudersModel
onItemsChanged: tabNameModel.update()
function onItemsChanged() { tabNameModel.update() }
}
ListModel

View file

@ -326,7 +326,7 @@ Item
Connections
{
target: Cura.MachineManager
onGlobalContainerChanged: extruderCountModel.update()
function onGlobalContainerChanged() { extruderCountModel.update() }
}
}

View file

@ -35,7 +35,7 @@ UM.TooltipArea
Connections
{
target: addedSettingsModel
onVisibleCountChanged:
function onVisibleCountChanged()
{
check.checked = addedSettingsModel.getVisible(model.key)
}

View file

@ -334,13 +334,13 @@ Item
Connections
{
target: inheritStackProvider
onPropertiesChanged: provider.forcePropertiesChanged()
function onPropertiesChanged() { provider.forcePropertiesChanged() }
}
Connections
{
target: UM.ActiveTool
onPropertiesChanged:
function onPropertiesChanged()
{
// the values cannot be bound with UM.ActiveTool.properties.getValue() calls,
// so here we connect to the signal and update the those values.

View file

@ -414,7 +414,7 @@ UM.Dialog
{
target: item
onShowTooltip:
function onShowTooltip(text)
{
tooltip.text = text
var position = settingLoader.mapToItem(settingsPanel, settingsPanel.x, 0)

View file

@ -55,8 +55,8 @@ Item
Connections
{
target: UM.SimulationView
onMaxPathsChanged: pathSlider.setHandleValue(UM.SimulationView.currentPath)
onCurrentPathChanged:
function onMaxPathsChanged() { pathSlider.setHandleValue(UM.SimulationView.currentPath) }
function onCurrentPathChanged()
{
// Only pause the simulation when the layer was changed manually, not when the simulation is running
if (pathSlider.manuallyChanged)
@ -89,7 +89,7 @@ Item
Connections
{
target: UM.Preferences
onPreferenceChanged:
function onPreferenceChanged(preference)
{
if (preference !== "view/only_show_top_layers" && preference !== "view/top_layer_count" && ! preference.match("layerview/"))
{
@ -221,9 +221,9 @@ Item
Connections
{
target: UM.SimulationView
onMaxLayersChanged: layerSlider.setUpperValue(UM.SimulationView.currentLayer)
onMinimumLayerChanged: layerSlider.setLowerValue(UM.SimulationView.minimumLayer)
onCurrentLayerChanged:
function onMaxLayersChanged() { layerSlider.setUpperValue(UM.SimulationView.currentLayer) }
function onMinimumLayerChanged() { layerSlider.setLowerValue(UM.SimulationView.minimumLayer) }
function onCurrentLayerChanged()
{
// Only pause the simulation when the layer was changed manually, not when the simulation is running
if (layerSlider.manuallyChanged)

View file

@ -22,7 +22,7 @@ Cura.ExpandableComponent
Connections
{
target: UM.Preferences
onPreferenceChanged:
function onPreferenceChanged(preference)
{
if (preference !== "view/only_show_top_layers" && preference !== "view/top_layer_count" && ! preference.match("layerview/"))
{

View file

@ -100,8 +100,8 @@ Window
Connections
{
target: toolbox
onShowLicenseDialog: { licenseDialog.show() }
onCloseLicenseDialog: { licenseDialog.close() }
function onShowLicenseDialog() { licenseDialog.show() }
function onCloseLicenseDialog() { licenseDialog.close() }
}
ToolboxLicenseDialog

View file

@ -112,8 +112,8 @@ Column
Connections
{
target: toolbox
onInstallChanged: installed = toolbox.isInstalled(model.id)
onFilterChanged:
function onInstallChanged() { installed = toolbox.isInstalled(model.id) }
function onFilterChanged()
{
installed = toolbox.isInstalled(model.id)
}

View file

@ -117,7 +117,7 @@ Item
Connections
{
target: toolbox
onEnabledChanged: isEnabled = toolbox.isEnabled(model.id)
function onEnabledChanged() { isEnabled = toolbox.isEnabled(model.id) }
}
}
}

View file

@ -81,7 +81,7 @@ Column
Connections
{
target: toolbox
onMetadataChanged:
function onMetadataChanged()
{
canDowngrade = toolbox.canDowngrade(model.id)
}

View file

@ -93,7 +93,7 @@ Item
Connections
{
target: CuraApplication
onAdditionalComponentsChanged: base.addAdditionalComponents()
function onAdditionalComponentsChanged(areaId) { base.addAdditionalComponents() }
}
function addAdditionalComponents()

View file

@ -127,7 +127,7 @@ Column
Connections
{
target: UM.Preferences
onPreferenceChanged:
function onPreferenceChanged(preference)
{
if (preference !== "general/auto_slice")
{

View file

@ -88,7 +88,7 @@ UM.MainWindow
{
// This connection is used when there is no ActiveMachine and the user is logged in
target: CuraApplication
onShowAddPrintersUncancellableDialog:
function onShowAddPrintersUncancellableDialog()
{
Cura.Actions.parent = backgroundItem
@ -102,7 +102,7 @@ UM.MainWindow
Connections
{
target: CuraApplication
onInitializationFinished:
function onInitializationFinished()
{
// Workaround silly issues with QML Action's shortcut property.
//
@ -471,19 +471,19 @@ UM.MainWindow
Connections
{
target: Cura.Actions.preferences
onTriggered: preferences.visible = true
function onTriggered() { preferences.visible = true }
}
Connections
{
target: CuraApplication
onShowPreferencesWindow: preferences.visible = true
function onShowPreferencesWindow() { preferences.visible = true }
}
Connections
{
target: Cura.Actions.addProfile
onTriggered:
function onTriggered()
{
preferences.show();
preferences.setPage(4);
@ -495,7 +495,7 @@ UM.MainWindow
Connections
{
target: Cura.Actions.configureMachines
onTriggered:
function onTriggered()
{
preferences.visible = true;
preferences.setPage(2);
@ -505,7 +505,7 @@ UM.MainWindow
Connections
{
target: Cura.Actions.manageProfiles
onTriggered:
function onTriggered()
{
preferences.visible = true;
preferences.setPage(4);
@ -515,7 +515,7 @@ UM.MainWindow
Connections
{
target: Cura.Actions.manageMaterials
onTriggered:
function onTriggered()
{
preferences.visible = true;
preferences.setPage(3)
@ -525,7 +525,7 @@ UM.MainWindow
Connections
{
target: Cura.Actions.configureSettingVisibility
onTriggered:
function onTriggered()
{
preferences.visible = true;
preferences.setPage(1);
@ -550,7 +550,7 @@ UM.MainWindow
Connections
{
target: Cura.MachineManager
onBlurSettings:
function onBlurSettings()
{
contentItem.forceActiveFocus()
}
@ -594,7 +594,7 @@ UM.MainWindow
Connections
{
target: CuraApplication
onShowConfirmExitDialog:
function onShowConfirmExitDialog(message)
{
exitConfirmationDialog.text = message;
exitConfirmationDialog.open();
@ -604,19 +604,19 @@ UM.MainWindow
Connections
{
target: Cura.Actions.quit
onTriggered: CuraApplication.checkAndExitApplication();
function onTriggered() { CuraApplication.checkAndExitApplication(); }
}
Connections
{
target: Cura.Actions.toggleFullScreen
onTriggered: base.toggleFullscreen()
function onTriggered() { base.toggleFullscreen() }
}
Connections
{
target: Cura.Actions.exitFullScreen
onTriggered: base.exitFullscreen()
function onTriggered() { base.exitFullscreen() }
}
FileDialog
@ -761,7 +761,7 @@ UM.MainWindow
Connections
{
target: Cura.Actions.open
onTriggered: openDialog.open()
function onTriggered() { openDialog.open() }
}
OpenFilesIncludingProjectsDialog
@ -777,7 +777,7 @@ UM.MainWindow
Connections
{
target: CuraApplication
onOpenProjectFile:
function onOpenProjectFile(project_file, add_to_recent_files)
{
askOpenAsProjectOrModelsDialog.fileUrl = project_file;
askOpenAsProjectOrModelsDialog.addToRecent = add_to_recent_files;
@ -788,7 +788,7 @@ UM.MainWindow
Connections
{
target: Cura.Actions.showProfileFolder
onTriggered:
function onTriggered()
{
var path = UM.Resources.getPath(UM.Resources.Preferences, "");
if(Qt.platform.os == "windows")
@ -820,7 +820,7 @@ UM.MainWindow
Connections
{
target: CuraApplication
onShowMessageBox:
function onShowMessageBox(title, text, informativeText, detailedText, buttons, icon)
{
messageDialog.title = title
messageDialog.text = text
@ -844,7 +844,7 @@ UM.MainWindow
Connections
{
target: CuraApplication
onShowDiscardOrKeepProfileChanges:
function onShowDiscardOrKeepProfileChanges()
{
discardOrKeepProfileChangesDialogLoader.sourceComponent = discardOrKeepProfileChangesDialogComponent
discardOrKeepProfileChangesDialogLoader.item.show()
@ -871,13 +871,13 @@ UM.MainWindow
Connections
{
target: Cura.Actions.whatsNew
onTriggered: whatsNewDialog.show()
function onTriggered() { whatsNewDialog.show() }
}
Connections
{
target: Cura.Actions.addMachine
onTriggered:
function onTriggered()
{
// Make sure to show from the first page when the dialog shows up.
addMachineDialog.resetModelState()
@ -893,7 +893,7 @@ UM.MainWindow
Connections
{
target: Cura.Actions.about
onTriggered: aboutDialog.visible = true;
function onTriggered() { aboutDialog.visible = true; }
}
Timer

View file

@ -92,6 +92,15 @@ Item
contentContainer.trySetPosition(contentContainer.x, contentContainer.y);
}
onEnabledChanged:
{
if (!base.enabled && expanded)
{
toggleContent();
updateDragPosition();
}
}
// Add this binding since the background color is not updated otherwise
Binding
{
@ -103,20 +112,6 @@ Item
}
}
// The panel needs to close when it becomes disabled
Connections
{
target: base
onEnabledChanged:
{
if (!base.enabled && expanded)
{
toggleContent();
updateDragPosition();
}
}
}
implicitHeight: 100 * screenScaleFactor
implicitWidth: 400 * screenScaleFactor
@ -300,7 +295,7 @@ Item
Connections
{
target: UM.Preferences
onPreferenceChanged:
function onPreferenceChanged(preference)
{
if
(
@ -342,8 +337,8 @@ Item
{
// Since it could be that the content is dynamically populated, we should also take these changes into account.
target: content.contentItem
onWidthChanged: content.width = content.contentItem.width + 2 * content.padding
onHeightChanged:
function onWidthChanged() { content.width = content.contentItem.width + 2 * content.padding }
function onHeightChanged()
{
content.height = content.contentItem.height + 2 * content.padding
contentContainer.height = contentHeader.height + content.height

View file

@ -78,6 +78,14 @@ Item
property int shadowOffset: 2
onEnabledChanged:
{
if (!base.enabled && expanded)
{
toggleContent()
}
}
function toggleContent()
{
if (content.visible)
@ -98,19 +106,6 @@ Item
value: base.enabled ? headerBackgroundColor : UM.Theme.getColor("disabled")
}
// The panel needs to close when it becomes disabled
Connections
{
target: base
onEnabledChanged:
{
if (!base.enabled && expanded)
{
toggleContent()
}
}
}
implicitHeight: 100 * screenScaleFactor
implicitWidth: 400 * screenScaleFactor
@ -247,7 +242,7 @@ Item
{
// Since it could be that the content is dynamically populated, we should also take these changes into account.
target: content.contentItem
onWidthChanged: content.width = content.contentItem.width + 2 * content.padding
onHeightChanged: content.height = content.contentItem.height + 2 * content.padding
function onWidthChanged() { content.width = content.contentItem.width + 2 * content.padding }
function onHeightChanged() { content.height = content.contentItem.height + 2 * content.padding }
}
}

View file

@ -149,7 +149,7 @@ Item
Connections
{
target: CuraApplication
onAdditionalComponentsChanged: base.addAdditionalComponents("jobSpecsButton")
function onAdditionalComponentsChanged(areaId) { base.addAdditionalComponents("jobSpecsButton") }
}
function addAdditionalComponents(areaId)

View file

@ -93,8 +93,8 @@ UM.TooltipArea
Connections
{
target: propertyProvider
onContainerStackChanged: defaultOptionsModel.updateModel()
onIsValueUsedChanged: defaultOptionsModel.updateModel()
function onContainerStackChanged() { defaultOptionsModel.updateModel() }
function onIsValueUsedChanged() { defaultOptionsModel.updateModel() }
}
Cura.ComboBox

View file

@ -54,7 +54,7 @@ NumericTextFieldWithUnit
Connections
{
target: textField
onActiveFocusChanged:
function onActiveFocusChanged()
{
// When this text field loses focus and the entered text is not valid, make sure to recreate the binding to
// show the correct value.

View file

@ -169,7 +169,7 @@ Item
Connections
{
target: Cura.Actions.newProject
onTriggered:
function onTriggered()
{
if(Printer.platformActivity || Cura.MachineManager.hasUserSettings)
{
@ -182,7 +182,7 @@ Item
Connections
{
target: Cura.Actions.browsePackages
onTriggered:
function onTriggered()
{
curaExtensions.callExtensionMethod("Toolbox", "launch")
}
@ -192,7 +192,7 @@ Item
Connections
{
target: Cura.Actions.marketplaceMaterials
onTriggered:
function onTriggered()
{
curaExtensions.callExtensionMethod("Toolbox", "launch")
curaExtensions.callExtensionMethod("Toolbox", "setViewCategoryToMaterials")

View file

@ -219,7 +219,7 @@ Button
Connections
{
target: Cura.MachineManager
onCurrentConfigurationChanged:
function onCurrentConfigurationChanged()
{
configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration)
}

View file

@ -126,7 +126,7 @@ Item
Connections
{
target: outputDevice
onUniqueConfigurationsChanged:
function onUniqueConfigurationsChanged()
{
forceModelUpdate()
}
@ -135,7 +135,7 @@ Item
Connections
{
target: Cura.MachineManager
onOutputDevicesChanged:
function onOutputDevicesChanged()
{
forceModelUpdate()
}

View file

@ -236,6 +236,6 @@ Cura.ExpandablePopup
Connections
{
target: Cura.MachineManager
onGlobalContainerChanged: popupItem.manual_selected_method = -1 // When switching printers, reset the value of the manual selected method
function onGlobalContainerChanged() { popupItem.manual_selected_method = -1 } // When switching printers, reset the value of the manual selected method
}
}

View file

@ -118,7 +118,7 @@ Item
Connections
{
target: Cura.ExtruderManager
onActiveExtruderChanged:
function onActiveExtruderChanged()
{
tabBar.setCurrentIndex(Cura.ExtruderManager.activeExtruderIndex);
}
@ -139,7 +139,7 @@ Item
Connections
{
target: repeater.model
onModelChanged:
function onModelChanged()
{
tabBar.setCurrentIndex(Cura.ExtruderManager.activeExtruderIndex)
}

View file

@ -90,13 +90,13 @@ Menu
Connections
{
target: UM.Controller
onContextMenuRequested: base.popup();
function onContextMenuRequested() { base.popup(); }
}
Connections
{
target: Cura.Actions.multiplySelection
onTriggered: multiplyDialog.open()
function onTriggered() { multiplyDialog.open() }
}
UM.SettingPropertyProvider

View file

@ -31,7 +31,7 @@ Menu
Connections
{
target: UM.Preferences
onPreferenceChanged:
function onPreferenceChanged(preference)
{
if (preference !== "general/camera_perspective_mode")
{

View file

@ -252,9 +252,10 @@ Item
buttonsRow.updateAdditionalComponents("monitorButtons")
}
Connections {
Connections
{
target: CuraApplication
onAdditionalComponentsChanged: buttonsRow.updateAdditionalComponents("monitorButtons")
function onAdditionalComponentsChanged() { buttonsRow.updateAdditionalComponents("monitorButtons") }
}
function updateAdditionalComponents (areaId) {

View file

@ -416,7 +416,7 @@ UM.PreferencesPage
Connections
{
target: UM.Preferences
onPreferenceChanged:
function onPreferenceChanged(preference)
{
if(preference != "general/camera_perspective_mode")
{
@ -856,7 +856,7 @@ UM.PreferencesPage
Connections
{
target: UM.Preferences
onPreferenceChanged:
function onPreferenceChanged(preference)
{
if (preference !== "info/send_slice_info")
{

View file

@ -166,7 +166,7 @@ UM.ManagementPage
Connections
{
target: Cura.MachineManager
onGlobalContainerChanged:
function onGlobalContainerChanged()
{
objectList.currentIndex = activeMachineIndex()
objectList.onCurrentIndexChanged()

View file

@ -134,7 +134,7 @@ Item
Connections
{
target: UM.Preferences
onPreferenceChanged:
function onPreferenceChanged(preference)
{
if (preference !== "cura/expanded_types" && preference !== "cura/expanded_brands")
{

View file

@ -124,13 +124,13 @@ Item
Connections
{
target: materialsModel
onItemsChanged: updateAfterModelChanges()
function onItemsChanged() { updateAfterModelChanges() }
}
Connections
{
target: genericMaterialsModel
onItemsChanged: updateAfterModelChanges()
function onItemsChanged() { updateAfterModelChanges() }
}
Column

View file

@ -124,7 +124,7 @@ Item
Connections
{
target: UM.Preferences
onPreferenceChanged:
function onPreferenceChanged(preference)
{
if (preference !== "cura/expanded_types" && preference !== "cura/expanded_brands")
{

View file

@ -217,7 +217,7 @@ Item
Connections
{
target: base.qualityManagementModel
onItemsChanged:
function onItemsChanged()
{
var toSelectItemName = base.currentItem == null ? "" : base.currentItem.name;
if (newQualityNameToSelect != "")

View file

@ -244,7 +244,7 @@ Item
Connections
{
target: Cura.ExtruderManager
onActiveExtruderChanged:
function onActiveExtruderChanged()
{
tabBar.setCurrentIndex(Cura.ExtruderManager.activeExtruderIndex);
}
@ -256,7 +256,7 @@ Item
Connections
{
target: repeater.model
onModelChanged:
function onModelChanged()
{
tabBar.setCurrentIndex(Cura.ExtruderManager.activeExtruderIndex)
}

View file

@ -84,7 +84,7 @@ Item
Connections
{
target: UM.Preferences
onPreferenceChanged:
function onPreferenceChanged(preference)
{
if (preference !== "view/settings_list_height" && preference !== "general/window_height" && preference !== "general/window_state")
{

View file

@ -128,7 +128,7 @@ Item
Connections
{
target: extruderModel
onModelChanged:
function onModelChanged()
{
var maybeColor = supportExtruderCombobox.model.getItem(supportExtruderCombobox.currentIndex).color
if (maybeColor)

View file

@ -17,7 +17,7 @@ Item
Connections
{
target: Cura.MachineManager
onGlobalContainerChanged:
function onGlobalContainerChanged()
{
outputDevice = Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null;
}

View file

@ -105,13 +105,13 @@ Button
Connections
{
target: outputDevice
onUniqueConfigurationsChanged: updatePrinterTypesFunction()
function onUniqueConfigurationsChanged() { updatePrinterTypesFunction() }
}
Connections
{
target: Cura.MachineManager
onOutputDevicesChanged: updatePrinterTypesFunction()
function onOutputDevicesChanged() { updatePrinterTypesFunction() }
}
Component.onCompleted: updatePrinterTypesFunction()

View file

@ -24,7 +24,7 @@ SettingItem
Connections
{
target: extrudersModel
onModelChanged:
function onModelChanged()
{
control.color = extrudersModel.getItem(control.currentIndex).color
}

View file

@ -29,7 +29,7 @@ SettingItem
Connections
{
target: base.extrudersWithOptionalModel
onModelChanged: control.color = base.extrudersWithOptionalModel.getItem(control.currentIndex).color
function onModelChanged() { control.color = base.extrudersWithOptionalModel.getItem(control.currentIndex).color }
}
textRole: "name"

View file

@ -357,16 +357,16 @@ Item
Connections
{
target: item
onContextMenuRequested:
function onContextMenuRequested()
{
contextMenu.key = model.key;
contextMenu.settingVisible = model.visible;
contextMenu.provider = provider
contextMenu.popup();
}
onShowTooltip: base.showTooltip(delegate, Qt.point(-settingsView.x - UM.Theme.getSize("default_margin").width, 0), text)
onHideTooltip: base.hideTooltip()
onShowAllHiddenInheritedSettings:
function onShowTooltip() { base.showTooltip(delegate, Qt.point(-settingsView.x - UM.Theme.getSize("default_margin").width, 0), text) }
function onHideTooltip() { base.hideTooltip() }
function onShowAllHiddenInheritedSettings()
{
var children_with_override = Cura.SettingInheritanceManager.getChildrenKeysWithOverride(category_id)
for(var i = 0; i < children_with_override.length; i++)
@ -375,7 +375,7 @@ Item
}
Cura.SettingInheritanceManager.manualRemoveOverride(category_id)
}
onFocusReceived:
function onFocusReceived()
{
contents.indexWithFocus = index;
animateContentY.from = contents.contentY;
@ -383,7 +383,7 @@ Item
animateContentY.to = contents.contentY;
animateContentY.running = true;
}
onSetActiveFocusToNextSetting:
function onSetActiveFocusToNextSetting()
{
if (forward == undefined || forward)
{

View file

@ -41,7 +41,7 @@ Item
Connections
{
target: CuraApplication.getDiscoveredPrintersModel()
onDiscoveredPrintersChanged:
function onDiscoveredPrintersChanged()
{
if (hasRequestFinished && currentRequestAddress)
{
@ -310,7 +310,7 @@ Item
Connections
{
target: CuraApplication.getDiscoveredPrintersModel()
onManualDeviceRequestFinished:
function onManualDeviceRequestFinished(success)
{
var discovered_printers_model = CuraApplication.getDiscoveredPrintersModel()
var printer = discovered_printers_model.discoveredPrintersByAddress[hostnameField.text]

View file

@ -35,7 +35,7 @@ Item
Connections
{
target: header
onClicked:
function onClicked()
{
base.contentShown = !base.contentShown
clicked()

View file

@ -27,7 +27,7 @@ Item
Connections
{
target: machineActionsModel
onAllFinished:
function onAllFinished()
{
if (visible)
{

View file

@ -61,6 +61,6 @@ Item
Connections
{
target: model
onAllFinished: dialog.visible = false
function onAllFinished() { dialog.visible = false }
}
}

View file

@ -47,6 +47,6 @@ Window
Connections
{
target: model
onAllFinished: dialog.hide()
function onAllFinished() { dialog.hide() }
}
}