src/gui/styles/qwindowsstyle.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
child 33 3e2da88830cd
--- a/src/gui/styles/qwindowsstyle.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/gui/styles/qwindowsstyle.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -41,7 +41,6 @@
 
 #include "qwindowsstyle.h"
 #include "qwindowsstyle_p.h"
-#include <private/qstylehelper_p.h>
 
 #if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)
 
@@ -70,13 +69,14 @@
 #include <private/qmath_p.h>
 #include <qmath.h>
 
-
 #ifdef Q_WS_X11
 #include "qfileinfo.h"
 #include "qdir.h"
 #include <private/qt_x11_p.h>
 #endif
 
+#include <private/qstylehelper_p.h>
+
 QT_BEGIN_NAMESPACE
 
 #if defined(Q_WS_WIN)
@@ -497,7 +497,7 @@
         {
 #ifndef Q_OS_WINCE
             NONCLIENTMETRICS ncm;
-            ncm.cbSize = sizeof(NONCLIENTMETRICS);
+            ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT);
             if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0))
                 ret = qMax(ncm.iScrollHeight, ncm.iScrollWidth);
             else
@@ -1911,7 +1911,7 @@
                 p->setPen(discol);
             }
 
-            int xm = QWindowsStylePrivate::windowsItemFrame + checkcol + QWindowsStylePrivate::windowsItemHMargin;
+            int xm = int(QWindowsStylePrivate::windowsItemFrame) + checkcol + int(QWindowsStylePrivate::windowsItemHMargin);
             int xpos = menuitem->rect.x() + xm;
             QRect textRect(xpos, y + QWindowsStylePrivate::windowsItemVMargin,
                            w - xm - QWindowsStylePrivate::windowsRightBorder - tab + 1, h - 2 * QWindowsStylePrivate::windowsItemVMargin);
@@ -3105,7 +3105,9 @@
                 qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On),
                                 &copy.palette.brush(QPalette::Button));
                 copy.rect.adjust(4, 1, -5, -1);
-                if (!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) ) {
+                if ((!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled))
+                    && proxy()->styleHint(SH_EtchDisabledText, opt, widget) )
+                {
                     QStyleOptionSpinBox lightCopy = copy;
                     lightCopy.rect.adjust(1, 1, 1, 1);
                     lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light());
@@ -3138,7 +3140,9 @@
                 qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On),
                                 &copy.palette.brush(QPalette::Button));
                 copy.rect.adjust(4, 0, -5, -1);
-                if (!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) ) {
+                if ((!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled))
+                    && proxy()->styleHint(SH_EtchDisabledText, opt, widget) )
+                {
                     QStyleOptionSpinBox lightCopy = copy;
                     lightCopy.rect.adjust(1, 1, 1, 1);
                     lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light());
@@ -3219,7 +3223,7 @@
 
             int checkcol = qMax<int>(maxpmw, QWindowsStylePrivate::windowsCheckMarkWidth); // Windows always shows a check column
             w += checkcol;
-            w += QWindowsStylePrivate::windowsRightBorder + 10;
+            w += int(QWindowsStylePrivate::windowsRightBorder) + 10;
             sz.setWidth(w);
         }
         break;