diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-05-09 16:29:39 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2023-05-11 12:47:53 +0200 |
commit | e3442c05bd63b70282e293fbd16c62acc28c4dd3 (patch) | |
tree | bc668da68b909c20452f67ab725c2d639b0a09f6 /src/widgets | |
parent | 64db65ae907b2d987c01768438dcae9643ceac96 (diff) |
QStyleSheetStyle: avoid #define ceil()
There's only one user of this function-like macro and already broke
unity-build, so make it a lambda instead and scope it close.
Remove the previous work-around (#undef at end of TU).
Pick-to: 6.5
Change-Id: I0bd7cd41b89a6f32144d2040ff2b4a18d0045d21
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 0b58044cc3..c2a720c433 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -138,8 +138,6 @@ class QStyleSheetStyleRecursionGuard if (globalStyleSheetStyle != 0 && globalStyleSheetStyle != this) { RETURN; } \ QStyleSheetStyleRecursionGuard recursion_guard(this); -#define ceil(x) ((int)(x) + ((x) > 0 && (x) != (int)(x))) - enum PseudoElement { PseudoElement_None, PseudoElement_DownArrow, @@ -4214,6 +4212,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q --chunkCount; }; } else if (chunkWidth > 0) { + const auto ceil = [](qreal x) { return int(x) + (x > 0 && x != int(x)); }; const int chunkCount = ceil(qreal(fillWidth)/chunkWidth); int x = reverse ? r.left() + r.width() - chunkWidth : r.x(); @@ -6490,8 +6489,6 @@ QPixmap QStyleSheetStyle::loadPixmap(const QString &fileName, const QObject *con return pixmap; } -#undef ceil - QT_END_NAMESPACE #include "moc_qstylesheetstyle_p.cpp" |