diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-08-10 18:50:22 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-08-14 07:27:39 +0000 |
commit | 18fa95d903efed7ef00fc3ca707365af8954fe8f (patch) | |
tree | 11193adde5e4084f7f092ee6b27b14233d864eec /src/imports/studio3d/q3dsstudio3ditem.cpp | |
parent | c2eb3d25207631dcb12917b4f06c85a9a49ccf95 (diff) |
Fix Studio3D with high-DPI
While not obvious at first, the sizing behavior was half-broken
with dpr > 1 (Qt3D got correct settings with the device pixel ratio
included, Q3DSEngine did not). The profileui did not show up either.
This is now corrected.
Change-Id: I7aa86d50e2eb0e24ca9e1888aae8f40b4efdf20e
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/imports/studio3d/q3dsstudio3ditem.cpp')
-rw-r--r-- | src/imports/studio3d/q3dsstudio3ditem.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/imports/studio3d/q3dsstudio3ditem.cpp b/src/imports/studio3d/q3dsstudio3ditem.cpp index 4bf64e8..c339c51 100644 --- a/src/imports/studio3d/q3dsstudio3ditem.cpp +++ b/src/imports/studio3d/q3dsstudio3ditem.cpp @@ -386,8 +386,9 @@ void Q3DSStudio3DItem::createEngine() const QString fn = QQmlFile::urlToLocalFileOrQrc(m_source); qCDebug(lcStudio3D) << "source is now" << fn; const QSize sz(width(), height()); + const qreal dpr = window()->effectiveDevicePixelRatio(); if (!sz.isEmpty()) - m_engine->resize(sz); + m_engine->resize(sz, dpr); QString err; m_sourceLoaded = m_engine->setSource(fn, &err, m_inlineQmlSubPresentations); @@ -398,7 +399,7 @@ void Q3DSStudio3DItem::createEngine() } if (!sz.isEmpty()) - sendResizeToQt3D(sz); + sendResizeToQt3D(sz, dpr); // cannot start() here, that must be deferred @@ -563,12 +564,13 @@ void Q3DSStudio3DItem::geometryChanged(const QRectF &newGeometry, const QRectF & if (!newGeometry.isEmpty() && m_engine && newGeometry.size() != oldGeometry.size()) { const QSize sz = newGeometry.size().toSize(); - m_engine->resize(sz); - sendResizeToQt3D(sz); + const qreal dpr = window()->effectiveDevicePixelRatio(); + m_engine->resize(sz, dpr); + sendResizeToQt3D(sz, dpr); } } -void Q3DSStudio3DItem::sendResizeToQt3D(const QSize &size) +void Q3DSStudio3DItem::sendResizeToQt3D(const QSize &size, qreal dpr) { Qt3DCore::QEntity *rootEntity = m_engine->rootEntity(); if (rootEntity) { @@ -576,7 +578,7 @@ void Q3DSStudio3DItem::sendResizeToQt3D(const QSize &size) qCDebug(lcStudio3D, "Setting external render target size on surface selector %p", surfaceSelector); if (surfaceSelector) { surfaceSelector->setExternalRenderTargetSize(size); - surfaceSelector->setSurfacePixelRatio(window()->effectiveDevicePixelRatio()); + surfaceSelector->setSurfacePixelRatio(dpr); } } } |