Don't use 'char' as a type of enum class.

QDataStream doesn't support serialization for this type.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2020-01-07 12:54:01 +02:00
parent 2a47cbf9b7
commit cf1e383d7b
22 changed files with 74 additions and 72 deletions

View File

@ -32,28 +32,30 @@
#include <QComboBox> #include <QComboBox>
#include <QDialog> #include <QDialog>
enum class Unit : char; enum class Unit : qint8;
class VAbstractLayoutDialog : public QDialog class VAbstractLayoutDialog : public QDialog
{ {
public: public:
enum class PaperSizeTemplate : char { A0 = 0, enum class PaperSizeTemplate : qint8 {
A1, A0 = 0,
A2, A1,
A3, A2,
A4, A3,
Letter, A4,
Legal, Letter,
Tabloid, Legal,
Roll24in, // Be carefull when change order for roll types Tabloid,
Roll30in, // Used also for showing icon Roll24in, // Be carefull when change order for roll types
Roll36in, Roll30in, // Used also for showing icon
Roll42in, Roll36in,
Roll44in, Roll42in,
Roll48in, Roll44in,
Roll62in, Roll48in,
Roll72in, Roll62in,
Custom}; Roll72in,
Custom
};
explicit VAbstractLayoutDialog(QWidget *parent = nullptr); explicit VAbstractLayoutDialog(QWidget *parent = nullptr);

View File

@ -192,7 +192,7 @@ private:
void PrintPreview(); void PrintPreview();
void LayoutPrint(); void LayoutPrint();
enum class PrintType : char {PrintPDF, PrintPreview, PrintNative}; enum class PrintType : qint8 {PrintPDF, PrintPreview, PrintNative};
void SetPrinterSettings(QPrinter *printer, const PrintType &printType); void SetPrinterSettings(QPrinter *printer, const PrintType &printType);
QPageSize::PageSizeId FindPageSizeId(const QSizeF &size) const; QPageSize::PageSizeId FindPageSizeId(const QSizeF &size) const;

View File

@ -49,14 +49,14 @@ class QDomElement;
class VPiecePath; class VPiecePath;
class VPieceNode; class VPieceNode;
enum class Document : char { FullLiteParse, LiteParse, LitePPParse, FullParse }; enum class Document : qint8 { FullLiteParse, LiteParse, LitePPParse, FullParse };
enum class LabelType : char {NewPatternPiece, NewLabel}; enum class LabelType : qint8 {NewPatternPiece, NewLabel};
// Don't touch values!!!. Same values stored in xml. // Don't touch values!!!. Same values stored in xml.
enum class CrossCirclesPoint : char {FirstPoint = 1, SecondPoint = 2}; enum class CrossCirclesPoint : qint8 {FirstPoint = 1, SecondPoint = 2};
enum class VCrossCurvesPoint : char {HighestPoint = 1, LowestPoint = 2}; enum class VCrossCurvesPoint : qint8 {HighestPoint = 1, LowestPoint = 2};
enum class HCrossCurvesPoint : char {LeftmostPoint = 1, RightmostPoint = 2}; enum class HCrossCurvesPoint : qint8 {LeftmostPoint = 1, RightmostPoint = 2};
enum class AxisType : char {VerticalAxis = 1, HorizontalAxis = 2}; enum class AxisType : qint8 {VerticalAxis = 1, HorizontalAxis = 2};
class VContainer; class VContainer;
class VDataTool; class VDataTool;

View File

@ -32,10 +32,10 @@
#include <QtGlobal> #include <QtGlobal>
#include <ciso646> #include <ciso646>
enum class VarMeasurement : unsigned char { English=0, Metric=1 }; enum class VarMeasurement : quint8 { English=0, Metric=1 };
//Default drawing units for AutoCAD DesignCenter blocks: //Default drawing units for AutoCAD DesignCenter blocks:
enum class VarInsunits : unsigned char { Inches=1, Millimeters=4, Centimeters=5 }; enum class VarInsunits : quint8 { Inches=1, Millimeters=4, Centimeters=5 };
// Helps mark end of string. See VDxfEngine::drawTextItem for more details // Helps mark end of string. See VDxfEngine::drawTextItem for more details
extern const QString endStringPlaceholder; extern const QString endStringPlaceholder;

View File

@ -41,7 +41,7 @@
class VContainer; class VContainer;
enum class GenderType : char { Male, Female, Unknown }; enum class GenderType : qint8 { Male, Female, Unknown };
class VMeasurements : public VDomDocument class VMeasurements : public VDomDocument
{ {

View File

@ -35,7 +35,7 @@
#include "../ifc/ifcdef.h" #include "../ifc/ifcdef.h"
enum class GOType : char enum class GOType : qint8
{ {
Point, Point,
Arc, Arc,
@ -47,10 +47,10 @@ enum class GOType : char
PlaceLabel, PlaceLabel,
Unknown Unknown
}; };
enum class SplinePointPosition : char { FirstPoint, LastPoint }; enum class SplinePointPosition : qint8 { FirstPoint, LastPoint };
// Keep synchronized with XSD schema // Keep synchronized with XSD schema
enum class PlaceLabelType : unsigned char enum class PlaceLabelType : quint8
{ {
Segment= 0, Segment= 0,
Rectangle = 1, Rectangle = 1,

View File

@ -49,7 +49,7 @@
Q_DECLARE_LOGGING_CATEGORY(lBank) Q_DECLARE_LOGGING_CATEGORY(lBank)
enum class Cases : char { CaseThreeGroup = 0, CaseTwoGroup, CaseDesc, UnknownCase}; enum class Cases : qint8 { CaseThreeGroup = 0, CaseTwoGroup, CaseDesc, UnknownCase};
class VBank class VBank
{ {

View File

@ -35,7 +35,7 @@
#include "../vmisc/typedef.h" #include "../vmisc/typedef.h"
enum class LayoutExportFormats : char enum class LayoutExportFormats : qint8
{ {
SVG = 0, SVG = 0,
PDF = 1, PDF = 1,
@ -75,7 +75,7 @@ enum class LayoutExportFormats : char
COUNT /*Use only for validation*/ COUNT /*Use only for validation*/
}; };
enum class LayoutErrors : char enum class LayoutErrors : qint8
{ {
NoError, NoError,
PrepareLayoutError, PrepareLayoutError,
@ -85,7 +85,7 @@ enum class LayoutErrors : char
TerminatedByException TerminatedByException
}; };
enum class BestFrom : char enum class BestFrom : qint8
{ {
Rotation = 0, Rotation = 0,
Combine = 1 Combine = 1

View File

@ -82,14 +82,14 @@ private:
*/ */
qreal angle_between{0}; qreal angle_between{0};
enum class CrossingType : char enum class CrossingType : qint8
{ {
NoIntersection = 0, NoIntersection = 0,
Intersection = 1, Intersection = 1,
EdgeError = 2 EdgeError = 2
}; };
enum class InsideType : char enum class InsideType : qint8
{ {
Outside = 0, Outside = 0,
Inside = 1, Inside = 1,

View File

@ -80,17 +80,17 @@ extern const qreal maxCurveApproximationScale;
extern const int minLabelFontSize; extern const int minLabelFontSize;
extern const int maxLabelFontSize; extern const int maxLabelFontSize;
enum class NodeDetail : char { Contour, Modeling }; enum class NodeDetail : qint8 { Contour, Modeling };
enum class SceneObject : char { Point, Line, Spline, Arc, ElArc, SplinePath, Detail, Unknown }; enum class SceneObject : qint8 { Point, Line, Spline, Arc, ElArc, SplinePath, Detail, Unknown };
enum class MeasurementsType : char { Multisize, Individual , Unknown}; enum class MeasurementsType : qint8 { Multisize, Individual , Unknown};
enum class Unit : char { Mm = 0, Cm, Inch, Px, LAST_UNIT_DO_NOT_USE}; enum class Unit : qint8 { Mm = 0, Cm, Inch, Px, LAST_UNIT_DO_NOT_USE};
enum class Source : char { FromGui, FromFile, FromTool }; enum class Source : qint8 { FromGui, FromFile, FromTool };
enum class NodeUsage : bool {NotInUse = false, InUse = true}; enum class NodeUsage : bool {NotInUse = false, InUse = true};
enum class SelectionType : bool {ByMousePress, ByMouseRelease}; enum class SelectionType : bool {ByMousePress, ByMouseRelease};
enum class PageOrientation : bool {Portrait = true, Landscape = false}; enum class PageOrientation : bool {Portrait = true, Landscape = false};
enum class Draw : char { Calculation, Modeling, Layout }; enum class Draw : qint8 { Calculation, Modeling, Layout };
enum class PieceNodeAngle : unsigned char enum class PieceNodeAngle : quint8
{ {
ByLength = 0, ByLength = 0,
ByPointsIntersection = 1, ByPointsIntersection = 1,
@ -102,7 +102,7 @@ enum class PieceNodeAngle : unsigned char
LAST_ONE_DO_NOT_USE LAST_ONE_DO_NOT_USE
}; };
enum class PassmarkLineType : unsigned char enum class PassmarkLineType : quint8
{ {
OneLine = 0, // Default OneLine = 0, // Default
TwoLines, TwoLines,
@ -118,7 +118,7 @@ enum class PassmarkLineType : unsigned char
QString PassmarkLineTypeToString(PassmarkLineType type); QString PassmarkLineTypeToString(PassmarkLineType type);
PassmarkLineType StringToPassmarkLineType(const QString &value); PassmarkLineType StringToPassmarkLineType(const QString &value);
enum class PassmarkAngleType : unsigned char enum class PassmarkAngleType : quint8
{ {
Straightforward = 0, // Default Straightforward = 0, // Default
Bisector, Bisector,
@ -139,13 +139,13 @@ Unit StrToUnits(const QString &unit);
QString UnitsToStr(const Unit &unit, const bool translate = false); QString UnitsToStr(const Unit &unit, const bool translate = false);
enum class PiecePathIncludeType : unsigned char enum class PiecePathIncludeType : quint8
{ {
AsMainPath = 0, AsMainPath = 0,
AsCustomSA = 1 AsCustomSA = 1
}; };
enum class PiecePathType : unsigned char {PiecePath = 0, CustomSeamAllowance = 1, InternalPath = 2, Unknown = 3}; enum class PiecePathType : quint8 {PiecePath = 0, CustomSeamAllowance = 1, InternalPath = 2, Unknown = 3};
typedef int ToolVisHolderType; typedef int ToolVisHolderType;
enum class Tool : ToolVisHolderType enum class Tool : ToolVisHolderType
@ -267,26 +267,26 @@ enum class Vis : ToolVisHolderType
LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used
}; };
enum class VarType : char { Measurement, Increment, IncrementSeparator, LineLength, CurveLength, CurveCLength, enum class VarType : qint8 { Measurement, Increment, IncrementSeparator, LineLength, CurveLength, CurveCLength,
LineAngle, CurveAngle, ArcRadius, Unknown }; LineAngle, CurveAngle, ArcRadius, Unknown };
enum class IncrementType : char { Increment, Separator }; enum class IncrementType : qint8 { Increment, Separator };
QString IncrementTypeToString(IncrementType type); QString IncrementTypeToString(IncrementType type);
IncrementType StringToIncrementType(const QString &value); IncrementType StringToIncrementType(const QString &value);
static const int heightStep = 6; static const int heightStep = 6;
enum class GHeights : unsigned char { ALL, enum class GHeights : quint8 { ALL,
H50=50, H56=56, H62=62, H68=68, H74=74, H80=80, H86=86, H92=92, H50=50, H56=56, H62=62, H68=68, H74=74, H80=80, H86=86, H92=92,
H98=98, H104=104, H110=110, H116=116, H122=122, H128=128, H134=134, H140=140, H98=98, H104=104, H110=110, H116=116, H122=122, H128=128, H134=134, H140=140,
H146=146, H152=152, H158=158, H164=164, H170=170, H176=176, H182=182, H188=188, H146=146, H152=152, H158=158, H164=164, H170=170, H176=176, H182=182, H188=188,
H194=194, H200=200}; H194=194, H200=200};
static const int sizeStep = 2; static const int sizeStep = 2;
enum class GSizes : unsigned char { ALL, enum class GSizes : quint8 { ALL,
S22=22, S24=24, S26=26, S28=28, S30=30, S32=32, S34=34, S36=36, S38=38, S40=40, S22=22, S24=24, S26=26, S28=28, S30=30, S32=32, S34=34, S36=36, S38=38, S40=40,
S42=42, S44=44, S46=46, S48=48, S50=50, S52=52, S54=54, S56=56, S58=58, S60=60, S42=42, S44=44, S46=46, S48=48, S50=50, S52=52, S54=54, S56=56, S58=58, S60=60,
S62=62, S64=64, S66=66, S68=68, S70=70, S72=72 }; S62=62, S64=64, S66=66, S68=68, S70=70, S72=72 };
/* QImage supports a maximum of 32768x32768 px images (signed short). /* QImage supports a maximum of 32768x32768 px images (signed short).
* This follows from the condition: width * height * colordepth < INT_MAX (4 billion) -> 32768 * 32768 * 4 = 4 billion. * This follows from the condition: width * height * colordepth < INT_MAX (4 billion) -> 32768 * 32768 * 4 = 4 billion.

View File

@ -33,7 +33,7 @@
#include <QString> #include <QString>
// denotes the type of arrow for the grainline // denotes the type of arrow for the grainline
enum class ArrowType : char enum class ArrowType : qint8
{ {
atBoth, atBoth,
atFront, atFront,

View File

@ -39,7 +39,7 @@ class VAbstractCurve;
class VSpline; class VSpline;
class VEllipticalArc; class VEllipticalArc;
enum class CurveAngle : char { StartAngle, EndAngle }; enum class CurveAngle : qint8 { StartAngle, EndAngle };
class VCurveAngle : public VCurveVariable class VCurveAngle : public VCurveVariable
{ {

View File

@ -35,7 +35,7 @@
#include "vcurvevariable.h" #include "vcurvevariable.h"
enum class CurveCLength : char { C1, C2 }; enum class CurveCLength : qint8 { C1, C2 };
class VAbstractBezier; class VAbstractBezier;
class VSpline; class VSpline;

View File

@ -36,7 +36,7 @@
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>
enum class FormulaType : char enum class FormulaType : qint8
{ {
ToUser = 0, ToUser = 0,
FromUser = 1, FromUser = 1,

View File

@ -68,7 +68,7 @@ Q_DECLARE_TYPEINFO(VPiecePassmarkData, Q_MOVABLE_TYPE);
QT_WARNING_POP QT_WARNING_POP
enum class PassmarkSide : char { All=0, Left=1, Right=2 }; enum class PassmarkSide : qint8 { All=0, Left=1, Right=2 };
class VPassmark class VPassmark
{ {

View File

@ -43,7 +43,7 @@ template <typename T> class QList;
namespace VPE namespace VPE
{ {
enum class Property : char{Simple, Complex}; enum class Property : qint8 {Simple, Complex};
static const int MyCustomEventType = 1099; static const int MyCustomEventType = 1099;

View File

@ -59,7 +59,7 @@ class VContainer;
class VPointF; class VPointF;
class VSplinePoint; class VSplinePoint;
class VPieceNode; class VPieceNode;
enum class GOType : char; enum class GOType : qint8;
struct VPiecePassmarkData; struct VPiecePassmarkData;
class AbstractTest : public QObject class AbstractTest : public QObject

View File

@ -68,7 +68,7 @@ class QLabel;
class QPlainTextEdit; class QPlainTextEdit;
class VAbstractTool; class VAbstractTool;
enum class FillComboBox : char { Whole, NoChildren}; enum class FillComboBox : qint8 { Whole, NoChildren};
/** /**
* @brief The DialogTool class parent for all dialog of tools. * @brief The DialogTool class parent for all dialog of tools.

View File

@ -37,7 +37,7 @@
#include "moveabstractlabel.h" #include "moveabstractlabel.h"
enum class MoveDoublePoint: char { FirstPoint, SecondPoint }; enum class MoveDoublePoint: qint8 { FirstPoint, SecondPoint };
class MoveDoubleLabel : public MoveAbstractLabel class MoveDoubleLabel : public MoveAbstractLabel
{ {

View File

@ -33,7 +33,7 @@
class QGraphicsScene; class QGraphicsScene;
enum class ShowDoublePoint: char { FirstPoint, SecondPoint }; enum class ShowDoublePoint: qint8 { FirstPoint, SecondPoint };
class ShowDoubleLabel : public VUndoCommand class ShowDoubleLabel : public VUndoCommand
{ {

View File

@ -42,7 +42,7 @@
Q_DECLARE_LOGGING_CATEGORY(vUndo) Q_DECLARE_LOGGING_CATEGORY(vUndo)
enum class UndoCommand: char enum class UndoCommand: qint8
{ {
AddPatternPiece, AddPatternPiece,
AddToCalc, AddToCalc,

View File

@ -49,7 +49,7 @@ class VScaledLine;
class VContainer; class VContainer;
class VInternalVariable; class VInternalVariable;
enum class Mode : char {Creation, Show}; enum class Mode : qint8 {Creation, Show};
class Visualization : public QObject class Visualization : public QObject
{ {