diff --git a/src/gui/Base/DelegateTransitionFixer.qml b/src/gui/Base/DelegateTransitionFixer.qml new file mode 100644 index 00000000..cbf8b508 --- /dev/null +++ b/src/gui/Base/DelegateTransitionFixer.qml @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later + +import QtQuick 2.12 + +Timer { + // Sometimes and randomly, a HListView/HGridView delegate's add/populate + // Transition will stop too early, leaving a stuck invisible or tiny item. + // This is a workaround for this Qt bug happening despite the neccessary + // Transition precautions from the docs being applied. + + property Item delegate: parent + + readonly property HNumberAnimation opacityFixer: HNumberAnimation { + target: delegate + property: "opacity" + from: delegate.opacity + to: 1 + } + + readonly property HNumberAnimation scaleFixer: HNumberAnimation { + target: delegate + property: "scale" + from: delegate.scale + to: 1 + } + + + interval: theme.animationDuration * 2 + running: true + onTriggered: { + // if (delegate.opacity < 1 || delegate.scale < 1) print(delegate) + if (delegate.opacity < 1) opacityFixer.start() + if (delegate.scale < 1) scaleFixer.start() + } +} diff --git a/src/gui/MainPane/AccountDelegate.qml b/src/gui/MainPane/AccountDelegate.qml index 5aad56fc..3b0e543f 100644 --- a/src/gui/MainPane/AccountDelegate.qml +++ b/src/gui/MainPane/AccountDelegate.qml @@ -243,4 +243,6 @@ HTile { sequences: window.settings.keys.togglePresenceOffline onActivated: account.togglePresence("offline") } + + DelegateTransitionFixer {} } diff --git a/src/gui/MainPane/RoomDelegate.qml b/src/gui/MainPane/RoomDelegate.qml index ee9245d7..c2a7d764 100644 --- a/src/gui/MainPane/RoomDelegate.qml +++ b/src/gui/MainPane/RoomDelegate.qml @@ -207,6 +207,8 @@ HTile { if (loadEventsFutureId) py.cancelCoro(loadEventsFutureId) } + DelegateTransitionFixer {} + Timer { interval: 1000 triggeredOnStart: true diff --git a/src/gui/Pages/AccountSettings/DeviceDelegate.qml b/src/gui/Pages/AccountSettings/DeviceDelegate.qml index 03f153d6..fbe5b18d 100644 --- a/src/gui/Pages/AccountSettings/DeviceDelegate.qml +++ b/src/gui/Pages/AccountSettings/DeviceDelegate.qml @@ -173,4 +173,6 @@ HTile { } onLeftClicked: checkBox.clicked() + + DelegateTransitionFixer {} } diff --git a/src/gui/Pages/AddAccount/ServerDelegate.qml b/src/gui/Pages/AddAccount/ServerDelegate.qml index 3f0619a7..ce9f3c17 100644 --- a/src/gui/Pages/AddAccount/ServerDelegate.qml +++ b/src/gui/Pages/AddAccount/ServerDelegate.qml @@ -92,4 +92,6 @@ HTile { } Behavior on contentOpacity { HNumberAnimation {} } + + DelegateTransitionFixer {} } diff --git a/src/gui/Pages/Chat/AutoCompletion/CompletableUserDelegate.qml b/src/gui/Pages/Chat/AutoCompletion/CompletableUserDelegate.qml index b11d1c16..d6272a48 100644 --- a/src/gui/Pages/Chat/AutoCompletion/CompletableUserDelegate.qml +++ b/src/gui/Pages/Chat/AutoCompletion/CompletableUserDelegate.qml @@ -49,4 +49,6 @@ HTile { Behavior on color { HColorAnimation {} } } } + + DelegateTransitionFixer {} } diff --git a/src/gui/Pages/Chat/FileTransfer/Transfer.qml b/src/gui/Pages/Chat/FileTransfer/Transfer.qml index 452126bb..dfc2e37f 100644 --- a/src/gui/Pages/Chat/FileTransfer/Transfer.qml +++ b/src/gui/Pages/Chat/FileTransfer/Transfer.qml @@ -33,6 +33,8 @@ HColumnLayout { Behavior on height { HNumberAnimation {} } + DelegateTransitionFixer {} + HRowLayout { HIcon { svgName: "uploading" diff --git a/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml b/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml index 3ed00193..d4a4285d 100644 --- a/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml +++ b/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml @@ -171,4 +171,6 @@ HTile { value: (roomPane.minimumSize - avatar.width) / 2 when: avatar && roomPane.width < avatar.width + theme.spacing * 2 } + + DelegateTransitionFixer {} } diff --git a/src/gui/Pages/Chat/RoomPane/MemberView/MemberDeviceDelegate.qml b/src/gui/Pages/Chat/RoomPane/MemberView/MemberDeviceDelegate.qml index 408a5be7..54956e8c 100644 --- a/src/gui/Pages/Chat/RoomPane/MemberView/MemberDeviceDelegate.qml +++ b/src/gui/Pages/Chat/RoomPane/MemberView/MemberDeviceDelegate.qml @@ -64,4 +64,6 @@ HTile { ) item.trustSet.connect(deviceTile.trustSet) } + + DelegateTransitionFixer {} } diff --git a/src/gui/Pages/Chat/Timeline/EventDelegate.qml b/src/gui/Pages/Chat/Timeline/EventDelegate.qml index a5244eb9..0249dc3b 100644 --- a/src/gui/Pages/Chat/Timeline/EventDelegate.qml +++ b/src/gui/Pages/Chat/Timeline/EventDelegate.qml @@ -84,6 +84,8 @@ HColumnLayout { ListView.onRemove: eventList.uncheck(model.id) + DelegateTransitionFixer {} + Item { Layout.fillWidth: true visible: model.event_type !== "RoomCreateEvent"