From e3442c05bd63b70282e293fbd16c62acc28c4dd3 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 9 May 2023 16:29:39 +0200 Subject: 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 Reviewed-by: Amir Masoud Abdol Reviewed-by: Friedemann Kleint --- src/widgets/styles/qstylesheetstyle.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/widgets/styles') 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" -- cgit v1.2.3