diff --git a/libs/command/kundo2stack.cpp b/libs/command/kundo2stack.cpp --- a/libs/command/kundo2stack.cpp +++ b/libs/command/kundo2stack.cpp @@ -502,10 +502,9 @@ KUndo2Action::KUndo2Action(const QString &textTemplate, const QString &defaultText, QObject *parent) : QAction(parent) + , m_textTemplate(textTemplate) + , m_defaultText(defaultText) { - m_textTemplate = textTemplate; - m_defaultText = defaultText; - } void KUndo2Action::setPrefixedText(const QString &text) diff --git a/libs/flake/KoCurveFit.cpp b/libs/flake/KoCurveFit.cpp --- a/libs/flake/KoCurveFit.cpp +++ b/libs/flake/KoCurveFit.cpp @@ -37,19 +37,22 @@ class FitVector { public: - FitVector(const QPointF &p) { - m_X = p.x(); - m_Y = p.y(); + FitVector(const QPointF &p) + : m_X(p.x()) + , m_Y(p.y()) + { } - FitVector() { - m_X = 0; - m_Y = 0; + FitVector() + : m_X(0) + , m_Y(0) + { } - FitVector(const QPointF &a, const QPointF &b) { - m_X = a.x() - b.x(); - m_Y = a.y() - b.y(); + FitVector(const QPointF &a, const QPointF &b) + : m_X(a.x() - b.x()) + , m_Y(a.y() - b.y()) + { } void normalize() { diff --git a/libs/flake/KoInsets.h b/libs/flake/KoInsets.h --- a/libs/flake/KoInsets.h +++ b/libs/flake/KoInsets.h @@ -37,11 +37,12 @@ * @param bottom the inset at the bottom * @param right the inset at the right */ - KoInsets(qreal top, qreal left, qreal bottom, qreal right) { - this->top = top; - this->left = left; - this->bottom = bottom; - this->right = right; + KoInsets(qreal top, qreal left, qreal bottom, qreal right) + : top(top) + , bottom(bottom) + , left(left) + , right(right) + { } /** * Constructor. diff --git a/libs/flake/commands/KoShapeLockCommand.cpp b/libs/flake/commands/KoShapeLockCommand.cpp --- a/libs/flake/commands/KoShapeLockCommand.cpp +++ b/libs/flake/commands/KoShapeLockCommand.cpp @@ -25,11 +25,10 @@ KoShapeLockCommand::KoShapeLockCommand(const QList &shapes, const QList &oldLock, const QList &newLock, KUndo2Command *parent) : KUndo2Command(parent) + , m_shapes(shapes) + , m_oldLock(oldLock) + , m_newLock(newLock) { - m_shapes = shapes; - m_oldLock = oldLock; - m_newLock = newLock; - Q_ASSERT(m_shapes.count() == m_oldLock.count()); Q_ASSERT(m_shapes.count() == m_newLock.count()); diff --git a/libs/flake/svg/SvgGradientHelper.cpp b/libs/flake/svg/SvgGradientHelper.cpp --- a/libs/flake/svg/SvgGradientHelper.cpp +++ b/libs/flake/svg/SvgGradientHelper.cpp @@ -38,11 +38,10 @@ } SvgGradientHelper::SvgGradientHelper(const SvgGradientHelper &other) - : m_gradient(0), m_gradientUnits(KoFlake::ObjectBoundingBox) + : m_gradient(KoFlake::cloneGradient(other.m_gradient)) + , m_gradientUnits(other.m_gradientUnits) + , m_gradientTransform(other.m_gradientTransform) { - m_gradientUnits = other.m_gradientUnits; - m_gradientTransform = other.m_gradientTransform; - m_gradient = KoFlake::cloneGradient(other.m_gradient); } SvgGradientHelper & SvgGradientHelper::operator = (const SvgGradientHelper & rhs) diff --git a/libs/flake/svg/SvgGraphicContext.h b/libs/flake/svg/SvgGraphicContext.h --- a/libs/flake/svg/SvgGraphicContext.h +++ b/libs/flake/svg/SvgGraphicContext.h @@ -40,43 +40,43 @@ SvgGraphicsContext(); void workaroundClearInheritedFillProperties(); - StyleType fillType; ///< the current fill type - Qt::FillRule fillRule; ///< the current fill rule - QColor fillColor; ///< the current fill color + StyleType fillType {Solid}; ///< the current fill type + Qt::FillRule fillRule {Qt::WindingFill}; ///< the current fill rule + QColor fillColor {QColor(Qt::black)}; ///< the current fill color. Default is black fill as per svg spec QString fillId; ///< the current fill id (used for gradient/pattern fills) - StyleType strokeType;///< the current stroke type + StyleType strokeType {None};///< the current stroke type QString strokeId; ///< the current stroke id (used for gradient strokes) KoShapeStrokeSP stroke; ///< the current stroke QString filterId; ///< the current filter id QString clipPathId; ///< the current clip path id QString clipMaskId; ///< the current clip mask id - Qt::FillRule clipRule; ///< the current clip rule - qreal opacity; ///< the shapes opacity + Qt::FillRule clipRule {Qt::WindingFill}; ///< the current clip rule + qreal opacity {1.0}; ///< the shapes opacity QTransform matrix; ///< the current transformation matrix QFont font; ///< the current font QStringList fontFamiliesList; ///< the full list of all the families to search glyphs in - QColor currentColor; ///< the current color + QColor currentColor {Qt::black}; ///< the current color QString xmlBaseDir; ///< the current base directory (used for loading external content) - bool preserveWhitespace;///< preserve whitespace in element text + bool preserveWhitespace {false}; ///< preserve whitespace in element text QRectF currentBoundingBox; ///< the current bound box used for bounding box units - bool forcePercentage; ///< force parsing coordinates/length as percentages of currentBoundbox + bool forcePercentage {false}; ///< force parsing coordinates/length as percentages of currentBoundbox QTransform viewboxTransform; ///< view box transformation - bool display; ///< controls display of shape - bool visible; ///< controls visibility of the shape (inherited) - bool isResolutionFrame; - qreal pixelsPerInch; ///< controls the resolution of the image raster - qreal forcedFontSizeCoeff; ///< workaround for a Krita 3.3 odf-based files that use different resolution for font size + bool display {true}; ///< controls display of shape + bool visible {true}; ///< controls visibility of the shape (inherited) + bool isResolutionFrame {false}; + qreal pixelsPerInch {72.0}; ///< controls the resolution of the image raster + qreal forcedFontSizeCoeff {1.0}; ///< workaround for a Krita 3.3 odf-based files that use different resolution for font size. No workaround by default QString markerStartId; QString markerMidId; QString markerEndId; - bool autoFillMarkers; + bool autoFillMarkers {false}; KoSvgTextProperties textProperties; }; diff --git a/libs/flake/svg/SvgGraphicContext.cpp b/libs/flake/svg/SvgGraphicContext.cpp --- a/libs/flake/svg/SvgGraphicContext.cpp +++ b/libs/flake/svg/SvgGraphicContext.cpp @@ -24,36 +24,13 @@ SvgGraphicsContext::SvgGraphicsContext() +: stroke(toQShared(new KoShapeStroke())) +, textProperties(KoSvgTextProperties::defaultProperties()) { - strokeType = None; - - stroke = toQShared(new KoShapeStroke()); stroke->setLineStyle(Qt::NoPen, QVector()); // default is no stroke stroke->setLineWidth(1.0); stroke->setCapStyle(Qt::FlatCap); stroke->setJoinStyle(Qt::MiterJoin); - - fillType = Solid; - fillRule = Qt::WindingFill; - fillColor = QColor(Qt::black); // default is black fill as per svg spec - - opacity = 1.0; - - currentColor = Qt::black; - forcePercentage = false; - - display = true; - visible = true; - isResolutionFrame = false; - - clipRule = Qt::WindingFill; - preserveWhitespace = false; - - pixelsPerInch = 72.0; - forcedFontSizeCoeff = 1.0; // no workaround by default - - autoFillMarkers = false; - textProperties = KoSvgTextProperties::defaultProperties(); } void SvgGraphicsContext::workaroundClearInheritedFillProperties() diff --git a/libs/flake/svg/parsers/SvgTransformParser.cpp b/libs/flake/svg/parsers/SvgTransformParser.cpp --- a/libs/flake/svg/parsers/SvgTransformParser.cpp +++ b/libs/flake/svg/parsers/SvgTransformParser.cpp @@ -76,18 +76,19 @@ { transform_unit() {} - transform_unit(const matrix &m) { - transform = QTransform(m.a, m.b, m.c, m.d, m.e, m.f); + transform_unit(const matrix &m) + : transform(QTransform(m.a, m.b, m.c, m.d, m.e, m.f)) + { } - transform_unit(const translate &t) { - transform = QTransform::fromTranslate(t.tx, t.ty); + transform_unit(const translate &t) + : transform(QTransform::fromTranslate(t.tx, t.ty)) + { } - transform_unit(const scale &sc) { - transform = - QTransform::fromScale(sc.sx, - sc.syPresent ? sc.sy : sc.sx); + transform_unit(const scale &sc) + : transform(QTransform::fromScale(sc.sx, sc.syPresent ? sc.sy : sc.sx)) + { } transform_unit(const rotate &r) {