Silence warning C4996 (use of deprecated GetDesktopDpi)
Silences warnings warning C4996: 'ID2D1Factory::GetDesktopDpi': Deprecated. Use DisplayInformation::LogicalDpi for Windows Store Apps or GetDpiForWindow for desktop apps. Using GetDpiForWindow sounds like the right approach, but it's not obvious where to get the window handle from here. Task-number: QTBUG-94043 Pick-to: 6.1 Change-Id: I2fc005e0c970c8338184f4500b876774ec9d976b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
19e789bace
commit
fd9c2c8033
@ -65,8 +65,11 @@ public:
|
||||
|
||||
D2D1_BITMAP_PROPERTIES1 bitmapProperties() const
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED // see QTBUG-94043
|
||||
FLOAT dpiX, dpiY;
|
||||
QWindowsDirect2DContext::instance()->d2dFactory()->GetDesktopDpi(&dpiX, &dpiY);
|
||||
QT_WARNING_POP
|
||||
|
||||
return D2D1::BitmapProperties1(
|
||||
D2D1_BITMAP_OPTIONS_TARGET,
|
||||
|
@ -103,6 +103,8 @@ int QWindowsDirect2DPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric)
|
||||
case QPaintDevice::PdmDpiX:
|
||||
case QPaintDevice::PdmPhysicalDpiX:
|
||||
{
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED // See QTBUG-94043
|
||||
FLOAT x, y;
|
||||
QWindowsDirect2DContext::instance()->d2dFactory()->GetDesktopDpi(&x, &y);
|
||||
return qRound(x);
|
||||
@ -113,6 +115,7 @@ int QWindowsDirect2DPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric)
|
||||
FLOAT x, y;
|
||||
QWindowsDirect2DContext::instance()->d2dFactory()->GetDesktopDpi(&x, &y);
|
||||
return qRound(y);
|
||||
QT_WARNING_POP
|
||||
}
|
||||
case QPaintDevice::PdmDevicePixelRatio:
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user