From 60a57db33e4c064e3a5a64a49abc27d17f335290 Mon Sep 17 00:00:00 2001 From: miruka Date: Wed, 16 Sep 2020 08:21:51 -0400 Subject: [PATCH] Fix QML Connections-using code for Qt 5.12 --- CHANGELOG.md | 2 ++ src/gui/Base/MediaPlayer/VideoPlayer.qml | 3 +-- src/gui/MainPane/RoomList.qml | 3 +-- src/gui/Pages/Chat/AutoCompletion/UserAutoCompletion.qml | 4 ++-- src/gui/Pages/Chat/Chat.qml | 2 +- src/gui/Pages/Chat/Composer/MessageArea.qml | 3 +-- src/gui/Pages/Chat/RoomPane/MemberView/MemberProfile.qml | 3 +-- src/gui/Pages/Chat/RoomPane/MemberView/MemberView.qml | 6 ++---- src/gui/Pages/Chat/RoomPane/RoomPane.qml | 9 ++------- src/gui/Pages/Chat/RoomPane/SettingsView.qml | 2 +- src/gui/Pages/Chat/Timeline/EventContent.qml | 8 ++------ src/gui/Pages/Chat/Timeline/EventList.qml | 2 +- src/gui/Popups/ConfirmClipboardUploadPopup.qml | 4 +--- src/main.cpp | 5 ++++- 14 files changed, 22 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df80f740..8a5a2a29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to - Fix checkboxes in the room settings not having their default values updated after switching room +- Fix various minor features broken on Qt 5.12 and the AppImage since v0.5.2 + ## 0.6.3 (2020-09-16) diff --git a/src/gui/Base/MediaPlayer/VideoPlayer.qml b/src/gui/Base/MediaPlayer/VideoPlayer.qml index 8a229d7f..2895f025 100644 --- a/src/gui/Base/MediaPlayer/VideoPlayer.qml +++ b/src/gui/Base/MediaPlayer/VideoPlayer.qml @@ -42,8 +42,7 @@ Video { Connections { target: mainUI.fullScreenPopup - - function onClosed() { fullScreen = false } + onClosed: fullScreen = false } TapHandler { diff --git a/src/gui/MainPane/RoomList.qml b/src/gui/MainPane/RoomList.qml index 73f2a593..d3c621a8 100644 --- a/src/gui/MainPane/RoomList.qml +++ b/src/gui/MainPane/RoomList.qml @@ -215,8 +215,7 @@ HListView { Connections { target: pageLoader - - function onPreviousShown(componentUrl, properties) { + onPreviousShown: (componentUrl, properties) => { if (setCorrectCurrentItem() === false) startCorrectItemSearch() } } diff --git a/src/gui/Pages/Chat/AutoCompletion/UserAutoCompletion.qml b/src/gui/Pages/Chat/AutoCompletion/UserAutoCompletion.qml index 9cc0a250..fa69a41c 100644 --- a/src/gui/Pages/Chat/AutoCompletion/UserAutoCompletion.qml +++ b/src/gui/Pages/Chat/AutoCompletion/UserAutoCompletion.qml @@ -145,7 +145,7 @@ HListView { Connections { target: root.textArea - function onCursorPositionChanged() { + onCursorPositionChanged: { if (! root.open) return const pos = root.textArea.cursorPosition @@ -162,7 +162,7 @@ HListView { if (pos < start || pos > end) root.accept() } - function onTextChanged() { + onTextChanged: { let changed = false for (const [id, name] of Object.entries(root.usersCompleted)) { diff --git a/src/gui/Pages/Chat/Chat.qml b/src/gui/Pages/Chat/Chat.qml index 41ecc3dc..9f9e9dbf 100644 --- a/src/gui/Pages/Chat/Chat.qml +++ b/src/gui/Pages/Chat/Chat.qml @@ -136,7 +136,7 @@ Item { Connections { target: pageLoader - function onRecycled() { roomPane.appearAnimation.restart() } + onRecycled: roomPane.appearAnimation.restart() } } } diff --git a/src/gui/Pages/Chat/Composer/MessageArea.qml b/src/gui/Pages/Chat/Composer/MessageArea.qml index 6db561f1..a2447694 100644 --- a/src/gui/Pages/Chat/Composer/MessageArea.qml +++ b/src/gui/Pages/Chat/Composer/MessageArea.qml @@ -248,8 +248,7 @@ HTextArea { Connections { target: pageLoader - - function onRecycled() { + onRecycled: { area.reset() area.loadState() } diff --git a/src/gui/Pages/Chat/RoomPane/MemberView/MemberProfile.qml b/src/gui/Pages/Chat/RoomPane/MemberView/MemberProfile.qml index 2fda60c5..ff3c0345 100644 --- a/src/gui/Pages/Chat/RoomPane/MemberView/MemberProfile.qml +++ b/src/gui/Pages/Chat/RoomPane/MemberView/MemberProfile.qml @@ -307,8 +307,7 @@ HListView { Connections { target: py.eventHandlers - - function onDeviceUpdateSignal(forAccount) { + onDeviceUpdateSignal: forAccount => { if (forAccount === root.userId) root.loadDevices() } } diff --git a/src/gui/Pages/Chat/RoomPane/MemberView/MemberView.qml b/src/gui/Pages/Chat/RoomPane/MemberView/MemberView.qml index 3d20886c..9b67c1ee 100644 --- a/src/gui/Pages/Chat/RoomPane/MemberView/MemberView.qml +++ b/src/gui/Pages/Chat/RoomPane/MemberView/MemberView.qml @@ -16,8 +16,7 @@ HColumnLayout { Connections { target: pageLoader - - function onAboutToRecycle() { + onAboutToRecycle: { stackView.pop(stackView.initialItem) filterField.reset() } @@ -78,8 +77,7 @@ HColumnLayout { Connections { target: pageLoader - - function onRecycled() { + onRecycled: { memberList.model = null updateModelTimer.restart() } diff --git a/src/gui/Pages/Chat/RoomPane/RoomPane.qml b/src/gui/Pages/Chat/RoomPane/RoomPane.qml index fafc52cc..ae384c17 100644 --- a/src/gui/Pages/Chat/RoomPane/RoomPane.qml +++ b/src/gui/Pages/Chat/RoomPane/RoomPane.qml @@ -88,18 +88,13 @@ MultiviewPane { Connections { target: swipeView - - function onCurrentItemChanged() { + onCurrentItemChanged: roomPane.swipeView.currentItem.keybindFocusItem.forceActiveFocus() - } } Connections { target: pageLoader - - function onAboutToRecycle() { - roomPane.swipeView.currentIndex = 0 - } + onAboutToRecycle: roomPane.swipeView.currentIndex = 0 } MemberView {} diff --git a/src/gui/Pages/Chat/RoomPane/SettingsView.qml b/src/gui/Pages/Chat/RoomPane/SettingsView.qml index 693223a4..120c3fbd 100644 --- a/src/gui/Pages/Chat/RoomPane/SettingsView.qml +++ b/src/gui/Pages/Chat/RoomPane/SettingsView.qml @@ -82,7 +82,7 @@ HFlickableColumnPage { Connections { target: pageLoader - function onAboutToRecycle() { cancel() } + onAboutToRecycle: cancel() } HRoomAvatar { diff --git a/src/gui/Pages/Chat/Timeline/EventContent.qml b/src/gui/Pages/Chat/Timeline/EventContent.qml index 876aa6be..ecaffbea 100644 --- a/src/gui/Pages/Chat/Timeline/EventContent.qml +++ b/src/gui/Pages/Chat/Timeline/EventContent.qml @@ -191,12 +191,8 @@ HRowLayout { Connections { target: eventList - - function onCheckedChanged() { - contentLabel.deselect() - } - - function onDelegateWithSelectedTextChanged() { + onCheckedChanged: contentLabel.deselect() + onDelegateWithSelectedTextChanged: { if (eventList.delegateWithSelectedText !== model.id) contentLabel.deselect() } diff --git a/src/gui/Pages/Chat/Timeline/EventList.qml b/src/gui/Pages/Chat/Timeline/EventList.qml index d09a39a2..d3dc674a 100644 --- a/src/gui/Pages/Chat/Timeline/EventList.qml +++ b/src/gui/Pages/Chat/Timeline/EventList.qml @@ -576,7 +576,7 @@ Rectangle { Connections { target: pageLoader - function onRecycled() { eventList.moreToLoad = true } + onRecycled: eventList.moreToLoad = true } } diff --git a/src/gui/Popups/ConfirmClipboardUploadPopup.qml b/src/gui/Popups/ConfirmClipboardUploadPopup.qml index 8f51a9ee..4a7be4b1 100644 --- a/src/gui/Popups/ConfirmClipboardUploadPopup.qml +++ b/src/gui/Popups/ConfirmClipboardUploadPopup.qml @@ -81,10 +81,8 @@ HColumnPopup { Connections { target: Clipboard - - function onContentChanged() { + onContentChanged: Clipboard.hasImage ? image.updateCounter += 1 : popup.close() - } } } } diff --git a/src/main.cpp b/src/main.cpp index 71e7a2b5..2e877d93 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -40,10 +40,13 @@ void loggingHandler( Q_UNUSED(context) // Hide dumb warnings about thing we can't fix without breaking - // compatibilty with Qt < 5.14 + // compatibilty with Qt < 5.14/5.15 if (msg.contains("QML Binding: Not restoring previous value because")) return; + if (msg.contains("QML Connections: Implicitly defined onFoo properties")) + return; + // Hide layout-related spam introduced in Qt 5.14 if (msg.contains("Qt Quick Layouts: Detected recursive rearrange.")) return;