File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828
2929#include " oshelper.h"
3030
31+ #include < algorithm>
3132#include < unordered_set>
3233
3334#include < QCoreApplication>
4546#include < QByteArray>
4647#include < QRandomGenerator>
4748#ifdef Q_OS_MAC
49+ #include < QEventLoop>
50+ #include < QThread>
4851#include " qt/macoshelper.h"
4952#endif
5053#ifdef Q_OS_WIN
@@ -74,6 +77,14 @@ QPixmap screenshot()
7477 window->hide ();
7578 }
7679 }
80+
81+ #if defined(Q_OS_MAC)
82+ // Let Qt submit the native hide operations before blocking the GUI thread.
83+ QGuiApplication::processEvents (QEventLoop::ExcludeUserInputEvents);
84+ // Give WindowServer time to finish removing the window.
85+ QThread::msleep (100 );
86+ #endif
87+
7788 const auto unhide = sg::make_scope_guard ([&hidden]() {
7889 for (QWindow *window : hidden)
7990 {
@@ -144,7 +155,7 @@ QList<QString> OSHelper::grabQrCodesFromScreen() const
144155 }
145156 catch (const std::exception &e)
146157 {
147- qWarning () << e.what ();
158+ qWarning () << " QR screen capture: decoder exception: " << e.what ();
148159 }
149160
150161 return codes;
You can’t perform that action at this time.
0 commit comments