1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | // W A R N I N G |
5 | // ------------- |
6 | // |
7 | // This file is not part of the Qt Chart API. It exists purely as an |
8 | // implementation detail. This header file may change from version to |
9 | // version without notice, or even be removed. |
10 | // |
11 | // We mean it. |
12 | |
13 | #ifndef CHARTHELPERS_P_H |
14 | #define CHARTHELPERS_P_H |
15 | |
16 | #include <QtCore/QtNumeric> |
17 | #include <QtCore/QPointF> |
18 | #include <QtCore/private/qglobal_p.h> |
19 | |
20 | static inline bool isValidValue(qreal value) |
21 | { |
22 | if (qIsNaN(d: value) || qIsInf(d: value)) { |
23 | qWarning(msg: "Ignored NaN, Inf, or -Inf value." ); |
24 | return false; |
25 | } |
26 | return true; |
27 | } |
28 | |
29 | static inline bool isValidValue(qreal x, qreal y) |
30 | { |
31 | return (isValidValue(value: x) && isValidValue(value: y)); |
32 | } |
33 | |
34 | static inline bool isValidValue(const QPointF point) |
35 | { |
36 | return (isValidValue(value: point.x()) && isValidValue(value: point.y())); |
37 | } |
38 | |
39 | #endif // CHARTHELPERS_P_H |
40 | |