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>
bb10
Marc Mutz 2023-05-09 16:29:39 +02:00
parent 64db65ae90
commit e3442c05bd
1 changed files with 1 additions and 4 deletions

View File

@ -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"