Fix QSysInfo::WindowsVersion checking (QSysInfo::WV_NT_based is a mask)

Manual merge of the original fix 1ef309e9 in the Qt 4.8 repo.

Task-number: QTBUG-20480
Change-Id: Id08500c2dd16965af3942e65cff1f4afa24180b0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
Joerg Bornemann 2012-03-22 15:00:56 +01:00 committed by Qt by Nokia
parent c6965407e5
commit 1a414cbc26
8 changed files with 14 additions and 14 deletions

View File

@ -362,7 +362,7 @@ QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL)
style = CS_DBLCLKS;
if (w->inherits("QTipLabel") || w->inherits("QAlphaWidget")) {
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
&& QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) {
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) {
style |= CS_DROPSHADOW;
}
cname += QStringLiteral("QToolTip");
@ -375,7 +375,7 @@ QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL)
cname += QStringLiteral("QPopup");
style = CS_DBLCLKS|CS_SAVEBITS;
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
&& QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
style |= CS_DROPSHADOW;
icon = false;
} else {

View File

@ -573,7 +573,7 @@ public:
}
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
&& QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
vistaInitPending = true;
#endif
}

View File

@ -291,7 +291,7 @@ void QWhatsThat::paintEvent(QPaintEvent*)
bool drawShadow = true;
#if defined(Q_WS_WIN)
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
&& QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
{
BOOL shadow;
SystemParametersInfo(SPI_GETDROPSHADOW, 0, &shadow, 0);

View File

@ -218,12 +218,12 @@ QStringList QStyleFactory::keys()
#endif
#ifndef QT_NO_STYLE_WINDOWSXP
if (!list.contains(QLatin1String("WindowsXP")) &&
(QSysInfo::WindowsVersion >= QSysInfo::WV_XP && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
(QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
list << QLatin1String("WindowsXP");
#endif
#ifndef QT_NO_STYLE_WINDOWSVISTA
if (!list.contains(QLatin1String("WindowsVista")) &&
(QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
(QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
list << QLatin1String("WindowsVista");
#endif
#ifndef QT_NO_STYLE_MOTIF

View File

@ -121,7 +121,7 @@ QWindowsStylePrivate::QWindowsStylePrivate()
{
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
&& QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) {
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) {
QSystemLibrary shellLib(QLatin1String("shell32"));
pSHGetStockIconInfo = (PtrSHGetStockIconInfo)shellLib.resolve("SHGetStockIconInfo");
}
@ -1045,7 +1045,7 @@ QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyl
case SP_VistaShield:
{
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
&& QSysInfo::WindowsVersion < QSysInfo::WV_NT_based
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)
&& pSHGetStockIconInfo)
{
QPixmap pixmap;
@ -1187,7 +1187,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
case SH_LineEdit_PasswordCharacter:
{
#ifdef Q_OS_WIN
if (widget && (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) {
if (widget && (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) {
const QFontMetrics &fm = widget->fontMetrics();
if (fm.inFont(QChar(0x25CF)))
ret = 0x25CF;
@ -3190,7 +3190,7 @@ QIcon QWindowsStyle::standardIconImplementation(StandardPixmap standardIcon, con
case SP_VistaShield:
{
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
&& QSysInfo::WindowsVersion < QSysInfo::WV_NT_based
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)
&& pSHGetStockIconInfo)
{
icon.addPixmap(proxy()->standardPixmap(SP_VistaShield, option, widget)); //fetches small icon

View File

@ -138,7 +138,7 @@ bool QWindowsVistaStylePrivate::useVista()
{
return (QWindowsVistaStylePrivate::useXP() &&
(QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA &&
QSysInfo::WindowsVersion < QSysInfo::WV_NT_based));
(QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)));
}
/*!

View File

@ -866,7 +866,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
inspectData = (tmt_transparentcolor != 0 || tmt_borderonly || proporigin == PO_PART || proporigin == PO_STATE);
// ### This is a vista-specific workaround for broken alpha in titlebar pixmaps
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) {
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) {
if (themeData.partId == WP_CAPTION || themeData.partId == WP_SMALLCAPTION)
inspectData = false;
}

View File

@ -213,10 +213,10 @@ void tst_QStyle::testStyleFactory()
#endif
#ifdef Q_WS_WIN
if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP &&
QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)
(QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
QVERIFY(keys.contains("WindowsXP"));
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA &&
QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)
(QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
QVERIFY(keys.contains("WindowsVista"));
#endif