summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-05-04 15:38:13 +0200
committerThiago Macieira <thiago.macieira@intel.com>2020-05-07 13:23:36 +0000
commite106dfdd6b5fa118993ea8b7ff4baf00102806ca (patch)
tree94d1c298303b56711bfd7cdde1a07711a102157c
parent891b60bbc84ddde077072df3426539c716d47459 (diff)
Clean up some more mixed enum/int math
Add casts when necessary, and replace a bitwise trick with the proper function call. Pick-To: 5.15 Change-Id: I8b3109781af1e7fdc5d1c4c3fafe43394c81d71d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/widgets/graphicsview/qgraphicslayout_p.h4
-rw-r--r--src/widgets/styles/qstyle.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/widgets/graphicsview/qgraphicslayout_p.h b/src/widgets/graphicsview/qgraphicslayout_p.h
index 9e86ae2f76..fa47eecf79 100644
--- a/src/widgets/graphicsview/qgraphicslayout_p.h
+++ b/src/widgets/graphicsview/qgraphicslayout_p.h
@@ -103,11 +103,11 @@ public:
inline void setDefaultSpacing(Qt::Orientation o, qreal spacing){
if (spacing >= 0)
- m_defaultSpacing[o - 1] = spacing;
+ m_defaultSpacing[int(o) - 1] = spacing;
}
inline qreal defaultSpacing(Qt::Orientation o) const {
- return m_defaultSpacing[o - 1];
+ return m_defaultSpacing[int(o) - 1];
}
inline qreal perItemSpacing(QSizePolicy::ControlType control1,
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 1e698028fd..e659ef5fcc 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -64,7 +64,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
return 0;
// optimization: exactly one bit is set
- if ((controls & (controls - 1)) == 0) {
+ if (qPopulationCount(uint(controls)) == 1) {
array[0] = QSizePolicy::ControlType(uint(controls));
return 1;
}