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 {
target: plasmoid
onExternalData: {
function onExternalData(mimetype, data) {
if (mimetype === "text/plain") {
noteText.text = data
}

View File

@ -14,13 +14,6 @@ install(DIRECTORY kirigamiplasmadesktopstyle/ DESTINATION ${KDE_INSTALL_QMLDIR}/
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
FILE(GLOB_RECURSE inFiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,13 +13,13 @@ import org.kde.kirigami 2.5 as Kirigami
T.Menu {
id: control
@DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette
palette: Kirigami.Theme.palette
implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
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
leftPadding: background.margins.left
@ -53,8 +53,7 @@ T.Menu {
Connections {
target: control.contentItem.contentItem
@DISABLE_AT_QT_5_14@ onChildrenChanged: {
@DISABLE_UNDER_QT_5_14@ function onChildrenChanged() {
function onChildrenChanged() {
for (var i in control.contentItem.contentItem.children) {
var child = control.contentItem.contentItem.children[i];
if (child.checkable) {

View File

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

View File

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

View File

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

View File

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

View File

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