Fix Connections warnings

Qt 5.14 introduced new syntax for defining Connections. Fix warnings like this one:
QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
This commit is contained in:
Konrad Materka 2020-12-19 23:13:52 +01:00
parent 1330b0279c
commit 1051a4045b
16 changed files with 50 additions and 47 deletions

View File

@ -18,7 +18,7 @@ PlasmaCore.SvgItem {
Connections { Connections {
target: plasmoid target: plasmoid
onExternalData: { function onExternalData(mimetype, data) {
if (mimetype === "text/plain") { if (mimetype === "text/plain") {
noteText.text = data noteText.text = data
} }

View File

@ -14,13 +14,6 @@ install(DIRECTORY kirigamiplasmadesktopstyle/ DESTINATION ${KDE_INSTALL_QMLDIR}/
set(QQC2_VERSION "2.${Qt5QuickControls2_VERSION_MINOR}") set(QQC2_VERSION "2.${Qt5QuickControls2_VERSION_MINOR}")
if (Qt5Qml_VERSION_STRING VERSION_GREATER_EQUAL 5.14)
set(DISABLE_UNDER_QT_5_14 "")
set(DISABLE_AT_QT_5_14 "//Disabled since Qt 5.14 ")
else()
set(DISABLE_UNDER_QT_5_14 "//Needs Qt 5.14 ")
set(DISABLE_AT_QT_5_14 "")
endif()
# Find all the source qml files # Find all the source qml files
FILE(GLOB_RECURSE inFiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" FILE(GLOB_RECURSE inFiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"

View File

@ -244,7 +244,7 @@ Item {
Connections { Connections {
target: theme target: theme
onTextColorChanged: { function onTextColorChanged() {
canvas.requestPaint(); canvas.requestPaint();
} }
} }

View File

@ -33,7 +33,7 @@ Item {
Connections { Connections {
target: highlight.ListView.view target: highlight.ListView.view
onCurrentIndexChanged: { function onCurrentIndexChanged() {
if (highlight.ListView.view.currentIndex >= 0) { if (highlight.ListView.view.currentIndex >= 0) {
background.opacity = 1 background.opacity = 1
} else { } else {

View File

@ -116,15 +116,15 @@ Item {
Connections { Connections {
target: flickableItem target: flickableItem
onContentHeightChanged: { function onContentHeightChanged() {
range.value = flickableItem.contentY range.value = flickableItem.contentY
} }
onContentYChanged: { function onContentYChanged() {
if (internalLoader.isVertical) { if (internalLoader.isVertical) {
range.value = flickableItem.contentY range.value = flickableItem.contentY
} }
} }
onContentXChanged: { function onContentXChanged() {
if (!internalLoader.isVertical) { if (!internalLoader.isVertical) {
range.value = flickableItem.contentX range.value = flickableItem.contentX
} }
@ -132,8 +132,12 @@ Item {
} }
Connections { Connections {
target: internalLoader.item.handle target: internalLoader.item.handle
onYChanged: updateFromHandleTimer.running = true function onYChanged() {
onXChanged: updateFromHandleTimer.running = true updateFromHandleTimer.running = true
}
function onXChanged() {
updateFromHandleTimer.running = true
}
} }
PlasmaComponents.RangeModel { PlasmaComponents.RangeModel {
id: range id: range

View File

@ -40,7 +40,7 @@ Item {
Connections { Connections {
target: listView target: listView
onModelChanged: { function onModelChanged() {
if (listView && listView.model) { if (listView && listView.model) {
internal.initDirtyObserver() internal.initDirtyObserver()
} }

View File

@ -68,20 +68,24 @@ Item {
//long notation to not make it overwritten by implementations //long notation to not make it overwritten by implementations
Connections { Connections {
target: (root != undefined) ? root : undefined target: (root != undefined) ? root : undefined
onPressedChanged: { function onPressedChanged() {
//TabBar is the granparent //TabBar is the granparent
internal.tabBar.currentTab = root internal.tabBar.currentTab = root
internal.tabBar.forceActiveFocus() internal.tabBar.forceActiveFocus()
} }
onClicked: { function onClicked() {
if (internal.tabGroup) { if (internal.tabGroup) {
internal.tabGroup.currentTab = tab internal.tabGroup.currentTab = tab
} }
//TabBar is the granparent, done here too in case of no tabgroup //TabBar is the granparent, done here too in case of no tabgroup
internal.tabBar.currentTab = root internal.tabBar.currentTab = root
} }
onVisibleChanged: root.parent.childrenChanged() function onVisibleChanged() {
onTextChanged: root.parent.childrenChanged() root.parent.childrenChanged()
}
function onTextChanged() {
root.parent.childrenChanged()
}
} }
QtObject { QtObject {

View File

@ -147,7 +147,9 @@ Item{
newContainer.opacity = 1 newContainer.opacity = 1
oldContainer.opacity = 0 oldContainer.opacity = 0
} }
onToolsChanged: connection.internalToolsChanged() function onToolsChanged() {
connection.internalToolsChanged()
}
Component.onCompleted: connection.internalToolsChanged() Component.onCompleted: connection.internalToolsChanged()
} }

View File

@ -64,7 +64,7 @@ Item {
Connections { Connections {
target: theme target: theme
//fallback if inline-background doesn't work //fallback if inline-background doesn't work
onThemeChanged: { function onThemeChanged() {
fallbackComponent.svgPath = fallbackComponent.filePath("/dialogs/background.svgz") fallbackComponent.svgPath = fallbackComponent.filePath("/dialogs/background.svgz")
shadowFrame.visible = backgroundSvg.hasElement("shadow-top") shadowFrame.visible = backgroundSvg.hasElement("shadow-top")
} }

View File

@ -87,7 +87,7 @@ PlasmaCore.FrameSvgItem {
Connections { Connections {
target: flickableItem target: flickableItem
onMovingChanged: { function onMovingChanged() {
if (flickableItem.moving) { if (flickableItem.moving) {
opacityTimer.running = false opacityTimer.running = false
background.opacity = 1 background.opacity = 1

View File

@ -13,13 +13,13 @@ import org.kde.kirigami 2.5 as Kirigami
T.Menu { T.Menu {
id: control id: control
@DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette palette: Kirigami.Theme.palette
implicitWidth: Math.max(background ? background.implicitWidth : 0, implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0) contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
implicitHeight: Math.max(background ? background.implicitHeight : 0, implicitHeight: Math.max(background ? background.implicitHeight : 0,
contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding
@DISABLE_UNDER_QQC2_2_3@ delegate: MenuItem { width: parent.width; onImplicitWidthChanged: control.contentItem.contentItem.childrenChanged() } delegate: MenuItem { width: parent.width; onImplicitWidthChanged: control.contentItem.contentItem.childrenChanged() }
margins: 0 margins: 0
leftPadding: background.margins.left leftPadding: background.margins.left
@ -53,8 +53,7 @@ T.Menu {
Connections { Connections {
target: control.contentItem.contentItem target: control.contentItem.contentItem
@DISABLE_AT_QT_5_14@ onChildrenChanged: { function onChildrenChanged() {
@DISABLE_UNDER_QT_5_14@ function onChildrenChanged() {
for (var i in control.contentItem.contentItem.children) { for (var i in control.contentItem.contentItem.children) {
var child = control.contentItem.contentItem.children[i]; var child = control.contentItem.contentItem.children[i];
if (child.checkable) { if (child.checkable) {

View File

@ -13,7 +13,7 @@ import org.kde.kirigami 2.5 as Kirigami
T.MenuItem { T.MenuItem {
id: controlRoot id: controlRoot
@DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette palette: Kirigami.Theme.palette
implicitWidth: Math.max(background ? background.implicitWidth : 0, implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentItem.implicitWidth + leftPadding + rightPadding + (arrow ? arrow.implicitWidth : 0)) contentItem.implicitWidth + leftPadding + rightPadding + (arrow ? arrow.implicitWidth : 0))
implicitHeight: Math.max(background ? background.implicitHeight : 0, implicitHeight: Math.max(background ? background.implicitHeight : 0,
@ -69,16 +69,15 @@ T.MenuItem {
} }
} }
//we can't use arrow: on old qqc2 releases arrow: PlasmaCore.IconItem {
@DISABLE_UNDER_QQC2_2_3@ arrow: PlasmaCore.IconItem { x: controlRoot.mirrored ? controlRoot.padding : controlRoot.width - width - controlRoot.padding
@DISABLE_UNDER_QQC2_2_3@ x: controlRoot.mirrored ? controlRoot.padding : controlRoot.width - width - controlRoot.padding y: controlRoot.topPadding + (controlRoot.availableHeight - height) / 2
@DISABLE_UNDER_QQC2_2_3@ y: controlRoot.topPadding + (controlRoot.availableHeight - height) / 2 source: controlRoot.mirrored ? "go-next-symbolic-rtl" : "go-next-symbolic"
@DISABLE_UNDER_QQC2_2_3@ source: controlRoot.mirrored ? "go-next-symbolic-rtl" : "go-next-symbolic" status: controlRoot.highlighted ? PlasmaCore.Svg.Selected : PlasmaCore.Svg.Normal
@DISABLE_UNDER_QQC2_2_3@ status: controlRoot.highlighted ? PlasmaCore.Svg.Selected : PlasmaCore.Svg.Normal width: Math.max(label.height, Kirigami.Units.iconSizes.small)
@DISABLE_UNDER_QQC2_2_3@ width: Math.max(label.height, Kirigami.Units.iconSizes.small) height: width
@DISABLE_UNDER_QQC2_2_3@ height: width visible: controlRoot.subMenu
@DISABLE_UNDER_QQC2_2_3@ visible: controlRoot.subMenu }
@DISABLE_UNDER_QQC2_2_3@ }
indicator: Loader { indicator: Loader {
x: controlRoot.mirrored ? controlRoot.width - width - controlRoot.rightPadding : controlRoot.leftPadding x: controlRoot.mirrored ? controlRoot.width - width - controlRoot.rightPadding : controlRoot.leftPadding

View File

@ -25,7 +25,7 @@ BusyIndicatorStyle {
Connections { Connections {
target: control target: control
onRunningChanged: { function onRunningChanged() {
rotationAnimator.from = rotation rotationAnimator.from = rotation
rotationAnimator.to = rotation + 360 rotationAnimator.to = rotation + 360
} }

View File

@ -85,7 +85,7 @@ Item {
Connections { Connections {
target: mouseArea target: mouseArea
onClicked: { function onClicked(mouse) {
if (control.menu && getMenuInstance().__popupVisible) { if (control.menu && getMenuInstance().__popupVisible) {
select(input.cursorPosition, input.cursorPosition); select(input.cursorPosition, input.cursorPosition);
} else { } else {
@ -98,7 +98,7 @@ Item {
} }
popupTimer.restart(); popupTimer.restart();
} }
onPressAndHold: { function onPressAndHold(mouse) {
input.activate(); input.activate();
var pos = input.positionAt(mouseArea.mouseX, mouseArea.mouseY); var pos = input.positionAt(mouseArea.mouseX, mouseArea.mouseY);
input.select(pos, pos); input.select(pos, pos);
@ -109,14 +109,14 @@ Item {
Connections { Connections {
target: input target: input
onSelectionStartChanged: popupTimer.restart() function onSelectionStartChanged() {popupTimer.restart()}
onSelectionEndChanged: popupTimer.restart() function onSelectionEndChanged() {popupTimer.restart()}
onActiveFocusChanged: popupTimer.restart() function onActiveFocusChanged() {popupTimer.restart()}
} }
Connections { Connections {
target: flickable target: flickable
onMovingChanged: popupTimer.restart() function onMovingChanged() {popupTimer.restart()}
} }
Timer { Timer {

View File

@ -46,7 +46,9 @@ QtQuickControlStyle.ScrollViewStyle {
Component.onCompleted: syncVelocity() Component.onCompleted: syncVelocity()
Connections { Connections {
target: control target: control
onContentItemChanged: syncVelocity() function onContentItemChanged() {
syncVelocity()
}
} }
frame: Item { frame: Item {

View File

@ -195,7 +195,7 @@ QtQuickControlStyle.ButtonStyle {
} }
Connections { Connections {
target: control target: control
onHoveredChanged: { function onHoveredChanged() {
if (style.controlHovered) { if (style.controlHovered) {
control.z += 2 control.z += 2
} else { } else {