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>
3940#include < QDir>
4041#include < QDebug>
4142#include < QDesktopServices>
43+ #include < QEventLoop>
4244#include < QFileInfo>
4345#include < QString>
4446#include < QUrl>
4547#include < QByteArray>
4648#include < QRandomGenerator>
49+ #include < QThread>
4750#ifdef Q_OS_MAC
4851#include " qt/macoshelper.h"
4952#endif
@@ -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