1// Copyright (C) 2023 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 QtGraphs 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
19QT_BEGIN_NAMESPACE
20
21static inline bool isValidValue(qreal value)
22{
23 if (qIsNaN(d: value) || qIsInf(d: value)) {
24 qWarning(msg: "Ignored NaN, Inf, or -Inf value.");
25 return false;
26 }
27 return true;
28}
29
30static inline bool isValidValue(qreal x, qreal y)
31{
32 return (isValidValue(value: x) && isValidValue(value: y));
33}
34
35static inline bool isValidValue(QPointF point)
36{
37 return (isValidValue(value: point.x()) && isValidValue(value: point.y()));
38}
39
40QT_END_NAMESPACE
41
42#endif // CHARTHELPERS_P_H
43

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

source code of qtgraphs/src/graphs2d/charthelpers_p.h