KD Chart 2  [rev.2.7]
KDChartEnums.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2001-2020 Klaralvdalens Datakonsult AB. All rights reserved.
3 **
4 ** This file is part of the KD Chart library.
5 **
6 ** Licensees holding valid commercial KD Chart licenses may use this file in
7 ** accordance with the KD Chart Commercial License Agreement provided with
8 ** the Software.
9 **
10 **
11 ** This file may be distributed and/or modified under the terms of the
12 ** GNU General Public License version 2 and version 3 as published by the
13 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included.
14 **
15 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 **
18 ** Contact info@kdab.com if any conditions of this licensing are not
19 ** clear to you.
20 **
21 **********************************************************************/
22 
23 #ifndef __KDCHARTENUMS_H__
24 #define __KDCHARTENUMS_H__
25 
26 #include "KDChartGlobal.h"
27 
28 #include <QRectF>
29 #include <QObject>
30 #include <QVector>
31 
40 class KDCHART_EXPORT KDChartEnums :public QObject
41 {
42  Q_OBJECT
43  Q_ENUMS( TextLayoutPolicy )
44  Q_ENUMS( AreaName )
45  Q_ENUMS( PositionFlag )
46 
47 public:
100  GranularitySequenceIrregular };
101 
110  switch ( sequence ) {
111  case GranularitySequence_10_20:
112  return QString::fromLatin1("GranularitySequence_10_20");
113  case GranularitySequence_10_50:
114  return QString::fromLatin1("GranularitySequence_10_50");
115  case GranularitySequence_25_50:
116  return QString::fromLatin1("GranularitySequence_25_50");
117  case GranularitySequence_125_25:
118  return QString::fromLatin1("GranularitySequence_125_25");
119  case GranularitySequenceIrregular:
120  return QString::fromLatin1("GranularitySequenceIrregular");
121  }
122  Q_ASSERT( !"Unknown GranularitySequenceValue" );
123  return QString::fromLatin1("GranularitySequence_10_20");
124  }
125 
126 
133  static GranularitySequence stringToGranularitySequence( const QString& string ) {
134  if ( string == QString::fromLatin1("GranularitySequence_10_20") )
135  return GranularitySequence_10_20;
136  if ( string == QString::fromLatin1("GranularitySequence_10_50") )
137  return GranularitySequence_10_50;
138  if ( string == QString::fromLatin1("GranularitySequence_25_50") )
139  return GranularitySequence_25_50;
140  if ( string == QString::fromLatin1("GranularitySequence_125") )
141  return GranularitySequence_125_25;
142  if ( string == QString::fromLatin1("GranularitySequenceIrregular") )
143  return GranularitySequenceIrregular;
144  // default, should not happen
145  return GranularitySequence_10_20;
146  }
147 
148 
161  enum TextLayoutPolicy { LayoutJustOverwrite,
165  LayoutPolicyShrinkFontSize };
166 
174  static QString layoutPolicyToString( TextLayoutPolicy type );
175 
176 
183  static TextLayoutPolicy stringToLayoutPolicy( const QString& string );
184 
185 
193  PositionUnknown = 0,
194  PositionCenter = 1,
195  PositionNorthWest = 2,
196  PositionNorth = 3,
197  PositionNorthEast = 4,
198  PositionEast = 5,
199  PositionSouthEast = 6,
200  PositionSouth = 7,
201  PositionSouthWest = 8,
202  PositionWest = 9,
203  PositionFloating =10
204  };
205 
206 
226  MeasureCalculationModeAutoOrientation };
227 
236  switch ( mode ) {
237  case MeasureCalculationModeAbsolute:
238  return QString::fromLatin1("MeasureCalculationModeAbsolute");
239  case MeasureCalculationModeAuto:
240  return QString::fromLatin1("MeasureCalculationModeAuto");
241  case MeasureCalculationModeAutoArea:
242  return QString::fromLatin1("MeasureCalculationModeAutoArea");
243  case MeasureCalculationModeAutoOrientation:
244  return QString::fromLatin1("MeasureCalculationModeAutoOrientation");
245  case MeasureCalculationModeRelative:
246  return QString::fromLatin1("MeasureCalculationModeRelative");
247  }
248  Q_ASSERT( !"unhandled MeasureCalculationMode" );
249  return QString::fromLatin1("MeasureCalculationModeAuto");
250  }
251 
252 
259  static MeasureCalculationMode stringToMeasureCalculationMode( const QString& string ) {
260  if ( string == QString::fromLatin1("MeasureCalculationModeAbsolute") )
261  return MeasureCalculationModeAbsolute;
262  if ( string == QString::fromLatin1("MeasureCalculationModeAuto") )
263  return MeasureCalculationModeAuto;
264  if ( string == QString::fromLatin1("MeasureCalculationModeAutoArea") )
265  return MeasureCalculationModeAutoArea;
266  if ( string == QString::fromLatin1("MeasureCalculationModeAutoOrientation") )
267  return MeasureCalculationModeAutoOrientation;
268  if ( string == QString::fromLatin1("MeasureCalculationModeRelative") )
269  return MeasureCalculationModeRelative;
270  // default, should not happen
271  return MeasureCalculationModeAuto;
272  }
273 
294  MeasureOrientationMaximum };
295 
304  switch ( mode ) {
305  case MeasureOrientationAuto:
306  return QString::fromLatin1("MeasureOrientationAuto");
307  case MeasureOrientationHorizontal:
308  return QString::fromLatin1("MeasureOrientationHorizontal");
309  case MeasureOrientationVertical:
310  return QString::fromLatin1("MeasureOrientationVertical");
311  case MeasureOrientationMinimum:
312  return QString::fromLatin1("MeasureOrientationMinimum");
313  case MeasureOrientationMaximum:
314  return QString::fromLatin1("MeasureOrientationMaximum");
315  }
316  Q_ASSERT( !"Unknown MeasureOrientation value" );
317  return QString::fromLatin1("MeasureOrientationAuto");
318  }
319 
320 
327  static MeasureOrientation stringToMeasureOrientation( const QString& string ) {
328  if ( string == QString::fromLatin1("MeasureOrientationAuto") )
329  return MeasureOrientationAuto;
330  if ( string == QString::fromLatin1("MeasureOrientationHorizontal") )
331  return MeasureOrientationHorizontal;
332  if ( string == QString::fromLatin1("MeasureOrientationVertical") )
333  return MeasureOrientationVertical;
334  if ( string == QString::fromLatin1("MeasureOrientationMinimum") )
335  return MeasureOrientationMinimum;
336  if ( string == QString::fromLatin1("MeasureOrientationMaximum") )
337  return MeasureOrientationMaximum;
338  // default, should not happen
339  return MeasureOrientationAuto;
340  }
341 
342 
343 };
344 
345 
346 #endif
MeasureOrientation
Measure orientation mode: the way how the absolute value of a KDChart::Measure is determined during K...
Definition: KDChartEnums.h:290
Project global class providing some enums needed both by KDChartParams and by KDChartCustomBox.
Definition: KDChartEnums.h:40
static GranularitySequence stringToGranularitySequence(const QString &string)
Converts the specified string to a granularity sequence enum value.
Definition: KDChartEnums.h:133
TextLayoutPolicy
Text layout policy: what to do if text that is to be drawn would cover neighboring text or neighborin...
Definition: KDChartEnums.h:161
static MeasureOrientation stringToMeasureOrientation(const QString &string)
Converts the specified string to a measure orientation enum value.
Definition: KDChartEnums.h:327
static QString measureCalculationModeToString(MeasureCalculationMode mode)
Converts the specified measure calculation mode enum to a string representation.
Definition: KDChartEnums.h:235
static QString granularitySequenceToString(GranularitySequence sequence)
Converts the specified granularity sequence enum to a string representation.
Definition: KDChartEnums.h:109
GranularitySequence
GranularitySequence specifies the values, that may be applied, to determine a step width within a giv...
Definition: KDChartEnums.h:95
MeasureCalculationMode
Measure calculation mode: the way how the absolute value of a KDChart::Measure is determined during K...
Definition: KDChartEnums.h:222
static MeasureCalculationMode stringToMeasureCalculationMode(const QString &string)
Converts the specified string to a measure calculation mode enum value.
Definition: KDChartEnums.h:259
PositionValue
Numerical values of the static KDChart::Position instances, for using a Position::value() with a swit...
Definition: KDChartEnums.h:192
static QString measureOrientationToString(MeasureOrientation mode)
Converts the specified measure orientation enum to a string representation.
Definition: KDChartEnums.h:303
Class only listed here to document inheritance of some KDChart classes.

Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/

https://www.kdab.com/development-resources/qt-tools/kd-chart/