Windows QPA: Fix clang warnings about narrowing conversions
Change-Id: Iba173b45fb77918694fc2c7506885fdeef9f6064 Reviewed-by: André de la Rocha <andre.rocha@qt.io>
parent
c150c7a566
commit
4df554c652
|
|
@ -69,12 +69,15 @@ inline D2D1_RECT_F to_d2d_rect_f(const QRectF &qrect)
|
|||
|
||||
inline D2D1_SIZE_U to_d2d_size_u(const QSizeF &qsize)
|
||||
{
|
||||
return D2D1::SizeU(qsize.width(), qsize.height());
|
||||
|
||||
return D2D1::SizeU(UINT32(qRound(qsize.width())),
|
||||
UINT32(qRound(qsize.height())));
|
||||
}
|
||||
|
||||
inline D2D1_SIZE_U to_d2d_size_u(const QSize &qsize)
|
||||
{
|
||||
return D2D1::SizeU(qsize.width(), qsize.height());
|
||||
return D2D1::SizeU(UINT32(qsize.width()),
|
||||
UINT32(qsize.height()));
|
||||
}
|
||||
|
||||
inline D2D1_POINT_2F to_d2d_point_2f(const QPointF &qpoint)
|
||||
|
|
|
|||
|
|
@ -931,7 +931,7 @@ bool QWindowsContext::systemParametersInfo(unsigned action, unsigned param, void
|
|||
bool QWindowsContext::systemParametersInfoForScreen(unsigned action, unsigned param, void *out,
|
||||
const QPlatformScreen *screen)
|
||||
{
|
||||
return systemParametersInfo(action, param, out, screen ? screen->logicalDpi().first : 0);
|
||||
return systemParametersInfo(action, param, out, screen ? unsigned(screen->logicalDpi().first) : 0u);
|
||||
}
|
||||
|
||||
bool QWindowsContext::systemParametersInfoForWindow(unsigned action, unsigned param, void *out,
|
||||
|
|
@ -950,7 +950,8 @@ bool QWindowsContext::nonClientMetrics(NONCLIENTMETRICS *ncm, unsigned dpi)
|
|||
bool QWindowsContext::nonClientMetricsForScreen(NONCLIENTMETRICS *ncm,
|
||||
const QPlatformScreen *screen)
|
||||
{
|
||||
return nonClientMetrics(ncm, screen ? screen->logicalDpi().first : 0);
|
||||
const int dpi = screen ? qRound(screen->logicalDpi().first) : 0;
|
||||
return nonClientMetrics(ncm, unsigned(dpi));
|
||||
}
|
||||
|
||||
bool QWindowsContext::nonClientMetricsForWindow(NONCLIENTMETRICS *ncm, const QPlatformWindow *win)
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data)
|
|||
} else {
|
||||
if (const HDC hdc = CreateDC(info.szDevice, nullptr, nullptr, nullptr)) {
|
||||
const QDpi dpi = monitorDPI(hMonitor);
|
||||
data->dpi = dpi.first ? dpi : deviceDPI(hdc);
|
||||
data->dpi = dpi.first > 0 ? dpi : deviceDPI(hdc);
|
||||
data->depth = GetDeviceCaps(hdc, BITSPIXEL);
|
||||
data->format = data->depth == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32;
|
||||
data->physicalSizeMM = QSizeF(GetDeviceCaps(hdc, HORZSIZE), GetDeviceCaps(hdc, VERTSIZE));
|
||||
|
|
|
|||
|
|
@ -851,10 +851,12 @@ static QSize toNativeSizeConstrained(QSize dip, const QWindow *w)
|
|||
{
|
||||
if (QHighDpiScaling::isActive()) {
|
||||
const qreal factor = QHighDpiScaling::factor(w);
|
||||
if (dip.width() > 0 && dip.width() < QWINDOWSIZE_MAX)
|
||||
dip.rwidth() *= factor;
|
||||
if (dip.height() > 0 && dip.height() < QWINDOWSIZE_MAX)
|
||||
dip.rheight() *= factor;
|
||||
if (!qFuzzyCompare(factor, qreal(1))) {
|
||||
if (dip.width() > 0 && dip.width() < QWINDOWSIZE_MAX)
|
||||
dip.setWidth(qRound(qreal(dip.width()) * factor));
|
||||
if (dip.height() > 0 && dip.height() < QWINDOWSIZE_MAX)
|
||||
dip.setHeight(qRound(qreal(dip.height()) * factor));
|
||||
}
|
||||
}
|
||||
return dip;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ void setVariantBool(bool value, VARIANT *variant)
|
|||
void setVariantDouble(double value, VARIANT *variant)
|
||||
{
|
||||
variant->vt = VT_R8;
|
||||
variant->boolVal = value;
|
||||
variant->dblVal = value;
|
||||
}
|
||||
|
||||
BSTR bStrFromQString(const QString &value)
|
||||
|
|
|
|||
Loading…
Reference in New Issue