From 3f05df19a1e3d772bdcc5faf1587af61b03377f1 Mon Sep 17 00:00:00 2001 From: NepNep21 Date: Tue, 9 Apr 2024 12:47:02 -0300 Subject: [PATCH 1/2] Fix image copying on windows --- src/timeline/TimelineModel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index b41d1e0c..8e8f72ce 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -2034,7 +2034,10 @@ TimelineModel::copyMedia(const QString &eventId) const clipContents->setImageData(img); } - QGuiApplication::clipboard()->setMimeData(clipContents); + // Qt uses COM for clipboard management on windows and our HTTP threads do not initialize it, so run in the event loop + QTimer::singleShot(0, ChatPage::instance(), [clipContents] { + QGuiApplication::clipboard()->setMimeData(clipContents); + }); return; } catch (const std::exception &e) { From 4810c2a2bc1d6977b9fc0f1e7c88b8c2baee4580 Mon Sep 17 00:00:00 2001 From: NepNep21 Date: Tue, 23 Apr 2024 19:58:14 -0300 Subject: [PATCH 2/2] Lint --- src/timeline/TimelineModel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index 8e8f72ce..3e3434b4 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -2034,7 +2034,8 @@ TimelineModel::copyMedia(const QString &eventId) const clipContents->setImageData(img); } - // Qt uses COM for clipboard management on windows and our HTTP threads do not initialize it, so run in the event loop + // Qt uses COM for clipboard management on windows and our HTTP threads do not + // initialize it, so run in the event loop QTimer::singleShot(0, ChatPage::instance(), [clipContents] { QGuiApplication::clipboard()->setMimeData(clipContents); });