1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the QtGraphs API. It exists purely as an
9// implementation detail. This header file may change from version to
10// version without notice, or even be removed.
11//
12// We mean it.
13
14#ifndef UTILS_P_H
15#define UTILS_P_H
16
17#include <private/graphsglobal_p.h>
18#include <QtGui/qimage.h>
19#include <QtGui/qquaternion.h>
20#include <QtCore/qlocale.h>
21
22QT_FORWARD_DECLARE_CLASS(QLinearGradient)
23
24QT_BEGIN_NAMESPACE
25
26class Utils
27{
28public:
29 enum ParamType {
30 ParamTypeUnknown = 0,
31 ParamTypeInt,
32 ParamTypeUInt,
33 ParamTypeReal
34 };
35
36 static ParamType preParseFormat(const QString &format, QString &preStr, QString &postStr,
37 int &precision, char &formatSpec);
38 static QString formatLabelSprintf(const QByteArray &format, ParamType paramType, qreal value);
39 static QString formatLabelLocalized(ParamType paramType, qreal value,
40 const QLocale &locale, const QString &preStr, const QString &postStr,
41 int precision, char formatSpec, const QByteArray &format);
42 static QString defaultLabelFormat();
43
44 static float wrapValue(float value, float min, float max);
45 static QQuaternion calculateRotation(const QVector3D &xyzRotations);
46 static void verifyGradientCompleteness(QLinearGradient &gradient);
47
48
49private:
50 static ParamType mapFormatCharToParamType(char formatSpec);
51};
52
53QT_END_NAMESPACE
54
55#endif
56

source code of qtgraphs/src/graphs/utils/utils_p.h