winrt: set initial window size

After creating the swapchain we set an initial size for the content
matching the screen size. Only afterwards append it to the canvas.

This fixes problems where dialogs were scaled wrongly, sometimes up to 4
times too big.

Task-number: QTBUG-50335
Change-Id: Ie3ad9aa3509dfa105ae2ac2b95d2662ff25cdeba
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
bb10
Maurice Kalinowski 2016-01-28 16:07:13 +01:00
parent 48ae2dac07
commit 6774edcef0
1 changed files with 9 additions and 0 deletions

View File

@ -133,6 +133,15 @@ QWinRTWindow::QWinRTWindow(QWindow *window)
hr = d->swapChainPanel.As(&d->uiElement);
Q_ASSERT_SUCCEEDED(hr);
ComPtr<Xaml::IFrameworkElement> frameworkElement;
hr = d->swapChainPanel.As(&frameworkElement);
Q_ASSERT_SUCCEEDED(hr);
const QSizeF size = QSizeF(d->screen->geometry().size()) / d->screen->scaleFactor();
hr = frameworkElement->put_Width(size.width());
Q_ASSERT_SUCCEEDED(hr);
hr = frameworkElement->put_Height(size.height());
Q_ASSERT_SUCCEEDED(hr);
ComPtr<IDependencyObject> canvas = d->screen->canvas();
ComPtr<IPanel> panel;
hr = canvas.As(&panel);