QWindowsTheme::themeHint(): Handle special value of SPI_GETWHEELSCROLLLINES

When the mouse wheel step is set to "Scroll one screen",  querying
SPI_GETWHEELSCROLLLINES returns the special value unsigned(-1). Return the
default instead of converting it to int in that case since Qt does not
implement it.

Task-number: QTBUG-52384
Change-Id: I793e5c09103fe0c7c4a378aba97e9f63ae1c2f35
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Friedemann Kleint 2016-07-25 08:57:47 +02:00
parent 1fcea11756
commit 8ea6e8d525

View File

@ -401,8 +401,13 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const
return QVariant(booleanSystemParametersInfo(SPI_GETSNAPTODEFBUTTON, false));
case ContextMenuOnMouseRelease:
return QVariant(true);
case WheelScrollLines:
return QVariant(int(dWordSystemParametersInfo(SPI_GETWHEELSCROLLLINES, 3)));
case WheelScrollLines: {
int result = 3;
const DWORD scrollLines = dWordSystemParametersInfo(SPI_GETWHEELSCROLLLINES, DWORD(result));
if (scrollLines != DWORD(-1)) // Special value meaning "scroll one screen", unimplemented in Qt.
result = int(scrollLines);
return QVariant(result);
}
default:
break;
}