KChart

KChartEnums.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3  *
4  * This file is part of the KD Chart library.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef __KChartEnums_H__
21 #define __KChartEnums_H__
22 
23 #include "KChartGlobal.h"
24 
25 #include <QRectF>
26 #include <QObject>
27 #include <QVector>
28 
37 class KCHART_EXPORT KChartEnums :public QObject
38 {
39  Q_OBJECT
41  Q_ENUMS( AreaName )
42  Q_ENUMS( PositionFlag )
43 
44 public:
93  GranularitySequence_10_20,
94  GranularitySequence_10_50,
95  GranularitySequence_25_50,
96  GranularitySequence_125_25,
97  GranularitySequenceIrregular };
98 
107  switch ( sequence ) {
108  case GranularitySequence_10_20:
109  return QString::fromLatin1("GranularitySequence_10_20");
110  case GranularitySequence_10_50:
111  return QString::fromLatin1("GranularitySequence_10_50");
112  case GranularitySequence_25_50:
113  return QString::fromLatin1("GranularitySequence_25_50");
114  case GranularitySequence_125_25:
115  return QString::fromLatin1("GranularitySequence_125_25");
116  case GranularitySequenceIrregular:
117  return QString::fromLatin1("GranularitySequenceIrregular");
118  }
119  Q_ASSERT( !"Unknown GranularitySequenceValue" );
120  return QString::fromLatin1("GranularitySequence_10_20");
121  }
122 
123 
131  if ( string == QString::fromLatin1("GranularitySequence_10_20") )
132  return GranularitySequence_10_20;
133  if ( string == QString::fromLatin1("GranularitySequence_10_50") )
134  return GranularitySequence_10_50;
135  if ( string == QString::fromLatin1("GranularitySequence_25_50") )
136  return GranularitySequence_25_50;
137  if ( string == QString::fromLatin1("GranularitySequence_125") )
138  return GranularitySequence_125_25;
139  if ( string == QString::fromLatin1("GranularitySequenceIrregular") )
140  return GranularitySequenceIrregular;
141  // default, should not happen
142  return GranularitySequence_10_20;
143  }
144 
145 
158  enum TextLayoutPolicy { LayoutJustOverwrite,
159  LayoutPolicyRotate,
160  LayoutPolicyShiftVertically,
161  LayoutPolicyShiftHorizontally,
162  LayoutPolicyShrinkFontSize };
163 
171  static QString layoutPolicyToString( TextLayoutPolicy type );
172 
173 
180  static TextLayoutPolicy stringToLayoutPolicy( const QString& string );
181 
182 
190  PositionUnknown = 0,
191  PositionCenter = 1,
192  PositionNorthWest = 2,
193  PositionNorth = 3,
194  PositionNorthEast = 4,
195  PositionEast = 5,
196  PositionSouthEast = 6,
197  PositionSouth = 7,
198  PositionSouthWest = 8,
199  PositionWest = 9,
200  PositionFloating =10
201  };
202 
203 
219  enum MeasureCalculationMode { MeasureCalculationModeAbsolute,
220  MeasureCalculationModeRelative,
221  MeasureCalculationModeAuto,
222  MeasureCalculationModeAutoArea,
223  MeasureCalculationModeAutoOrientation };
224 
233  switch ( mode ) {
234  case MeasureCalculationModeAbsolute:
235  return QString::fromLatin1("MeasureCalculationModeAbsolute");
236  case MeasureCalculationModeAuto:
237  return QString::fromLatin1("MeasureCalculationModeAuto");
238  case MeasureCalculationModeAutoArea:
239  return QString::fromLatin1("MeasureCalculationModeAutoArea");
240  case MeasureCalculationModeAutoOrientation:
241  return QString::fromLatin1("MeasureCalculationModeAutoOrientation");
242  case MeasureCalculationModeRelative:
243  return QString::fromLatin1("MeasureCalculationModeRelative");
244  }
245  Q_ASSERT( !"unhandled MeasureCalculationMode" );
246  return QString::fromLatin1("MeasureCalculationModeAuto");
247  }
248 
249 
257  if ( string == QString::fromLatin1("MeasureCalculationModeAbsolute") )
258  return MeasureCalculationModeAbsolute;
259  if ( string == QString::fromLatin1("MeasureCalculationModeAuto") )
260  return MeasureCalculationModeAuto;
261  if ( string == QString::fromLatin1("MeasureCalculationModeAutoArea") )
262  return MeasureCalculationModeAutoArea;
263  if ( string == QString::fromLatin1("MeasureCalculationModeAutoOrientation") )
264  return MeasureCalculationModeAutoOrientation;
265  if ( string == QString::fromLatin1("MeasureCalculationModeRelative") )
266  return MeasureCalculationModeRelative;
267  // default, should not happen
268  return MeasureCalculationModeAuto;
269  }
270 
287  enum MeasureOrientation { MeasureOrientationAuto,
288  MeasureOrientationHorizontal,
289  MeasureOrientationVertical,
290  MeasureOrientationMinimum,
291  MeasureOrientationMaximum };
292 
301  switch ( mode ) {
302  case MeasureOrientationAuto:
303  return QString::fromLatin1("MeasureOrientationAuto");
304  case MeasureOrientationHorizontal:
305  return QString::fromLatin1("MeasureOrientationHorizontal");
306  case MeasureOrientationVertical:
307  return QString::fromLatin1("MeasureOrientationVertical");
308  case MeasureOrientationMinimum:
309  return QString::fromLatin1("MeasureOrientationMinimum");
310  case MeasureOrientationMaximum:
311  return QString::fromLatin1("MeasureOrientationMaximum");
312  }
313  Q_ASSERT( !"Unknown MeasureOrientation value" );
314  return QString::fromLatin1("MeasureOrientationAuto");
315  }
316 
317 
325  if ( string == QString::fromLatin1("MeasureOrientationAuto") )
326  return MeasureOrientationAuto;
327  if ( string == QString::fromLatin1("MeasureOrientationHorizontal") )
328  return MeasureOrientationHorizontal;
329  if ( string == QString::fromLatin1("MeasureOrientationVertical") )
330  return MeasureOrientationVertical;
331  if ( string == QString::fromLatin1("MeasureOrientationMinimum") )
332  return MeasureOrientationMinimum;
333  if ( string == QString::fromLatin1("MeasureOrientationMaximum") )
334  return MeasureOrientationMaximum;
335  // default, should not happen
336  return MeasureOrientationAuto;
337  }
338 
339 
340 };
341 
342 
343 #endif
PositionValue
Numerical values of the static KChart::Position instances, for using a Position::value() with a switc...
Definition: KChartEnums.h:189
MeasureCalculationMode
Measure calculation mode: the way how the absolute value of a KChart::Measure is determined during KC...
Definition: KChartEnums.h:219
static QString measureCalculationModeToString(MeasureCalculationMode mode)
Converts the specified measure calculation mode enum to a string representation.
Definition: KChartEnums.h:232
Project global class providing some enums needed both by KChartParams and by KChartCustomBox.
Definition: KChartEnums.h:37
static MeasureOrientation stringToMeasureOrientation(const QString &string)
Converts the specified string to a measure orientation enum value.
Definition: KChartEnums.h:324
Class only listed here to document inheritance of some KChart classes.
TextLayoutPolicy
Text layout policy: what to do if text that is to be drawn would cover neighboring text or neighborin...
Definition: KChartEnums.h:158
Contains KChart macros.
MeasureOrientation
Measure orientation mode: the way how the absolute value of a KChart::Measure is determined during KC...
Definition: KChartEnums.h:287
GranularitySequence
GranularitySequence specifies the values, that may be applied, to determine a step width within a giv...
Definition: KChartEnums.h:92
static MeasureCalculationMode stringToMeasureCalculationMode(const QString &string)
Converts the specified string to a measure calculation mode enum value.
Definition: KChartEnums.h:256
static QString granularitySequenceToString(GranularitySequence sequence)
Converts the specified granularity sequence enum to a string representation.
Definition: KChartEnums.h:106
Q_ENUMS(...)
QString fromLatin1(const char *str, int size)
static QString measureOrientationToString(MeasureOrientation mode)
Converts the specified measure orientation enum to a string representation.
Definition: KChartEnums.h:300
static GranularitySequence stringToGranularitySequence(const QString &string)
Converts the specified string to a granularity sequence enum value.
Definition: KChartEnums.h:130
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Sep 24 2020 22:36:57 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.