diff options
author | Samuel Nevala <samuel.nevala@intopalo.com> | 2015-11-17 09:32:20 +0200 |
---|---|---|
committer | Andrew Knight <andrew.knight@intopalo.com> | 2015-11-18 06:05:23 +0000 |
commit | aecf3006bddb959795d03dd72d9c520e49713913 (patch) | |
tree | 3176eab3e7fa4521e2088cd8cf0e024823703ecf /src | |
parent | 3dd6ac244fce7ed5f09910b427eaf0eac338be4b (diff) |
winrt: Fix startup orientation handling
Calling QWinRTScreen::onOrientationChanged in the class constructor
can lead to situation where QWinRTScreen is expected to be fully
constructed. Moving the onOrientationChanged call to
QWinRTScreen::initialize ensures that QWinRTScreen is fully
constructed when it is called.
Task-Id: QTBUG-49470
Change-Id: I52748f33a9011dec3a172c1a74023cad15aae38a
Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/winrt/qwinrtscreen.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 5bb29d3805..158917184c 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -507,11 +507,7 @@ QWinRTScreen::QWinRTScreen() hr = d->displayInformation->get_NativeOrientation(&displayOrientation); Q_ASSERT_SUCCEEDED(hr); d->nativeOrientation = static_cast<Qt::ScreenOrientation>(static_cast<int>(qtOrientationsFromNative(displayOrientation))); - - // Set initial orientation & pixel density - onDpiChanged(Q_NULLPTR, Q_NULLPTR); d->orientation = d->nativeOrientation; - onOrientationChanged(Q_NULLPTR, Q_NULLPTR); ComPtr<IApplicationViewStatics2> applicationViewStatics; hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_ApplicationView).Get(), @@ -757,6 +753,8 @@ void QWinRTScreen::initialize() Q_ASSERT_SUCCEEDED(hr); hr = d->displayInformation->add_DpiChanged(Callback<DisplayInformationHandler>(this, &QWinRTScreen::onDpiChanged).Get(), &d->displayTokens[&IDisplayInformation::remove_DpiChanged]); Q_ASSERT_SUCCEEDED(hr); + onDpiChanged(Q_NULLPTR, Q_NULLPTR); + onOrientationChanged(Q_NULLPTR, Q_NULLPTR); onVisibilityChanged(nullptr, nullptr); } |