| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the Qt Data Visualization module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:GPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU |
| 19 | ** General Public License version 3 or (at your option) any later version |
| 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
| 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
| 22 | ** included in the packaging of this file. Please review the following |
| 23 | ** information to ensure the GNU General Public License requirements will |
| 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 25 | ** |
| 26 | ** $QT_END_LICENSE$ |
| 27 | ** |
| 28 | ****************************************************************************/ |
| 29 | |
| 30 | // |
| 31 | // W A R N I N G |
| 32 | // ------------- |
| 33 | // |
| 34 | // This file is not part of the QtDataVisualization API. It exists purely as an |
| 35 | // implementation detail. This header file may change from version to |
| 36 | // version without notice, or even be removed. |
| 37 | // |
| 38 | // We mean it. |
| 39 | |
| 40 | #ifndef QVALUE3DAXISFORMATTER_P_H |
| 41 | #define QVALUE3DAXISFORMATTER_P_H |
| 42 | |
| 43 | #include "datavisualizationglobal_p.h" |
| 44 | #include "qvalue3daxisformatter.h" |
| 45 | #include "utils_p.h" |
| 46 | #include <QtCore/QLocale> |
| 47 | |
| 48 | QT_BEGIN_NAMESPACE_DATAVISUALIZATION |
| 49 | |
| 50 | class QValue3DAxis; |
| 51 | |
| 52 | class QValue3DAxisFormatterPrivate : public QObject |
| 53 | { |
| 54 | Q_OBJECT |
| 55 | |
| 56 | public: |
| 57 | QValue3DAxisFormatterPrivate(QValue3DAxisFormatter *q); |
| 58 | virtual ~QValue3DAxisFormatterPrivate(); |
| 59 | |
| 60 | void recalculate(); |
| 61 | void doRecalculate(); |
| 62 | void populateCopy(QValue3DAxisFormatter ©); |
| 63 | void doPopulateCopy(QValue3DAxisFormatterPrivate ©); |
| 64 | |
| 65 | QString stringForValue(qreal value, const QString &format); |
| 66 | float positionAt(float value) const; |
| 67 | float valueAt(float position) const; |
| 68 | |
| 69 | void setAxis(QValue3DAxis *axis); |
| 70 | void markDirty(bool labelsChange); |
| 71 | |
| 72 | public Q_SLOTS: |
| 73 | void markDirtyNoLabelChange(); |
| 74 | |
| 75 | protected: |
| 76 | QValue3DAxisFormatter *q_ptr; |
| 77 | |
| 78 | bool m_needsRecalculate; |
| 79 | |
| 80 | float m_min; |
| 81 | float m_max; |
| 82 | float m_rangeNormalizer; |
| 83 | |
| 84 | QVector<float> m_gridPositions; |
| 85 | QVector<float> m_subGridPositions; |
| 86 | QVector<float> m_labelPositions; |
| 87 | QStringList m_labelStrings; |
| 88 | |
| 89 | QValue3DAxis *m_axis; |
| 90 | |
| 91 | QString m_previousLabelFormat; |
| 92 | QByteArray m_labelFormatArray; |
| 93 | Utils::ParamType m_preparsedParamType; |
| 94 | |
| 95 | bool m_allowNegatives; |
| 96 | bool m_allowZero; |
| 97 | |
| 98 | QLocale m_locale; |
| 99 | QString m_formatPreStr; |
| 100 | QString m_formatPostStr; |
| 101 | int m_formatPrecision; |
| 102 | char m_formatSpec; |
| 103 | bool m_cLocaleInUse; |
| 104 | |
| 105 | friend class QValue3DAxisFormatter; |
| 106 | }; |
| 107 | |
| 108 | QT_END_NAMESPACE_DATAVISUALIZATION |
| 109 | |
| 110 | #endif |
| 111 | |