summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qwindowsxpstyle_p_p.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-03-01 15:40:52 +0100
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-04-05 07:27:37 +0000
commit34a984c80739d034b6c0c9e0f29c73b03ddc5aa1 (patch)
treee52bf8be9a50124293e32040a8c079e2ffb07225 /src/widgets/styles/qwindowsxpstyle_p_p.h
parent670a9c00ef5ee4bbcbaaefa9482e39359180ac4f (diff)
Windows XP style: Change theme logic to use qreal.
Avoid rounding errors, thus preventing sizes becoming too small when High DPI scaling is in effect. Also fix division by zero crashes should a scale factor be below 1. Task-number: QTBUG-49374 Task-number: QTBUG-51552 Change-Id: I72718521bc3c7f6b0e42392ea2d2d3bbc61e2faa Reviewed-by: Marko Kangas <marko.kangas@theqtcompany.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com> Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
Diffstat (limited to 'src/widgets/styles/qwindowsxpstyle_p_p.h')
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p_p.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h
index c2571b4a79..240a338c3f 100644
--- a/src/widgets/styles/qwindowsxpstyle_p_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p_p.h
@@ -202,15 +202,15 @@ public:
static RECT toRECT(const QRect &qr);
bool isValid();
- QSize size();
- QMargins margins(const QRect &rect, int propId = TMT_CONTENTMARGINS);
- QMargins margins(int propId = TMT_CONTENTMARGINS);
+ QSizeF size();
+ QMarginsF margins(const QRect &rect, int propId = TMT_CONTENTMARGINS);
+ QMarginsF margins(int propId = TMT_CONTENTMARGINS);
- static QSize themeSize(const QWidget *w = 0, QPainter *p = 0, int themeIn = -1, int part = 0, int state = 0);
- static QMargins themeMargins(const QRect &rect, const QWidget *w = 0, QPainter *p = 0, int themeIn = -1,
- int part = 0, int state = 0, int propId = TMT_CONTENTMARGINS);
- static QMargins themeMargins(const QWidget *w = 0, QPainter *p = 0, int themeIn = -1,
- int part = 0, int state = 0, int propId = TMT_CONTENTMARGINS);
+ static QSizeF themeSize(const QWidget *w = 0, QPainter *p = 0, int themeIn = -1, int part = 0, int state = 0);
+ static QMarginsF themeMargins(const QRect &rect, const QWidget *w = 0, QPainter *p = 0, int themeIn = -1,
+ int part = 0, int state = 0, int propId = TMT_CONTENTMARGINS);
+ static QMarginsF themeMargins(const QWidget *w = 0, QPainter *p = 0, int themeIn = -1,
+ int part = 0, int state = 0, int propId = TMT_CONTENTMARGINS);
const QWidget *widget;
QPainter *painter;
@@ -427,9 +427,9 @@ private:
static HTHEME m_themes[NThemes];
};
-inline QSize XPThemeData::size()
+inline QSizeF XPThemeData::size()
{
- QSize result(0, 0);
+ QSizeF result(0, 0);
if (isValid()) {
SIZE size;
if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemePartSize(handle(), 0, partId, stateId, 0, TS_TRUE, &size)))
@@ -438,9 +438,9 @@ inline QSize XPThemeData::size()
return result;
}
-inline QMargins XPThemeData::margins(const QRect &qRect, int propId)
+inline QMarginsF XPThemeData::margins(const QRect &qRect, int propId)
{
- QMargins result(0, 0, 0 ,0);
+ QMarginsF result(0, 0, 0 ,0);
if (isValid()) {
MARGINS margins;
RECT rect = XPThemeData::toRECT(qRect);
@@ -450,9 +450,9 @@ inline QMargins XPThemeData::margins(const QRect &qRect, int propId)
return result;
}
-inline QMargins XPThemeData::margins(int propId)
+inline QMarginsF XPThemeData::margins(int propId)
{
- QMargins result(0, 0, 0 ,0);
+ QMarginsF result(0, 0, 0 ,0);
if (isValid()) {
MARGINS margins;
if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemeMargins(handle(), 0, partId, stateId, propId, NULL, &margins)))
@@ -461,21 +461,21 @@ inline QMargins XPThemeData::margins(int propId)
return result;
}
-inline QSize XPThemeData::themeSize(const QWidget *w, QPainter *p, int themeIn, int part, int state)
+inline QSizeF XPThemeData::themeSize(const QWidget *w, QPainter *p, int themeIn, int part, int state)
{
XPThemeData theme(w, p, themeIn, part, state);
return theme.size();
}
-inline QMargins XPThemeData::themeMargins(const QRect &rect, const QWidget *w, QPainter *p, int themeIn,
- int part, int state, int propId)
+inline QMarginsF XPThemeData::themeMargins(const QRect &rect, const QWidget *w, QPainter *p, int themeIn,
+ int part, int state, int propId)
{
XPThemeData theme(w, p, themeIn, part, state);
return theme.margins(rect, propId);
}
-inline QMargins XPThemeData::themeMargins(const QWidget *w, QPainter *p, int themeIn,
- int part, int state, int propId)
+inline QMarginsF XPThemeData::themeMargins(const QWidget *w, QPainter *p, int themeIn,
+ int part, int state, int propId)
{
XPThemeData theme(w, p, themeIn, part, state);
return theme.margins(propId);