mirror of https://github.com/qt/qtbase.git
winrt: Fix MessageDialog show on windows phone.
Run native dialog show on XAML thread. Change-Id: I6273340e87d70aae21c838d9d7646a233c1f48be Task-Id: QTBUG-47938 Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
This commit is contained in:
parent
df49755d74
commit
9cdbf48c33
|
@ -38,7 +38,9 @@
|
||||||
#include "qwinrttheme.h"
|
#include "qwinrttheme.h"
|
||||||
|
|
||||||
#include <QtCore/qfunctions_winrt.h>
|
#include <QtCore/qfunctions_winrt.h>
|
||||||
|
#include <private/qeventdispatcher_winrt_p.h>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
#include <windows.ui.popups.h>
|
#include <windows.ui.popups.h>
|
||||||
#include <windows.foundation.h>
|
#include <windows.foundation.h>
|
||||||
#include <windows.foundation.collections.h>
|
#include <windows.foundation.collections.h>
|
||||||
|
@ -168,16 +170,20 @@ bool QWinRTMessageDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ComPtr<IAsyncOperation<IUICommand *>> op;
|
hr = QEventDispatcherWinRT::runOnXamlThread([this, d, dialog]() {
|
||||||
hr = dialog->ShowAsync(&op);
|
HRESULT hr;
|
||||||
RETURN_FALSE_IF_FAILED("Failed to show dialog");
|
ComPtr<IAsyncOperation<IUICommand *>> op;
|
||||||
hr = op->put_Completed(Callback<DialogCompletedHandler>(this, &QWinRTMessageDialogHelper::onCompleted).Get());
|
hr = dialog->ShowAsync(&op);
|
||||||
RETURN_FALSE_IF_FAILED("Failed to set dialog callback");
|
RETURN_HR_IF_FAILED("Failed to show dialog");
|
||||||
|
hr = op->put_Completed(Callback<DialogCompletedHandler>(this, &QWinRTMessageDialogHelper::onCompleted).Get());
|
||||||
d->shown = true;
|
RETURN_HR_IF_FAILED("Failed to set dialog callback");
|
||||||
hr = op.As(&d->info);
|
d->shown = true;
|
||||||
RETURN_FALSE_IF_FAILED("Failed to acquire AsyncInfo for MessageDialog");
|
hr = op.As(&d->info);
|
||||||
|
RETURN_HR_IF_FAILED("Failed to acquire AsyncInfo for MessageDialog");
|
||||||
|
return hr;
|
||||||
|
});
|
||||||
|
|
||||||
|
RETURN_FALSE_IF_FAILED("Failed to show dialog")
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue