Skip to content

Commit 8791aac

Browse files
committed
Modernise some code
1 parent 2bc8ff3 commit 8791aac

File tree

8 files changed

+18
-21
lines changed

8 files changed

+18
-21
lines changed

python/core/layout/qgslayoutmeasurementconverter.sip

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ class QgsLayoutMeasurementConverter
2727
public:
2828

2929
QgsLayoutMeasurementConverter();
30+
%Docstring
31+
Constructor for QgsLayoutMeasurementConverter.
32+
%End
3033

3134
void setDpi( const double dpi );
3235
%Docstring

src/core/layout/qgslayoutmeasurement.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ class CORE_EXPORT QgsLayoutMeasurement
123123

124124
private:
125125

126-
double mLength;
127-
QgsUnitTypes::LayoutUnit mUnits;
126+
double mLength = 0.0;
127+
QgsUnitTypes::LayoutUnit mUnits = QgsUnitTypes::LayoutMillimeters;
128128

129129
};
130130

src/core/layout/qgslayoutmeasurementconverter.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818
#include "qgslayoutmeasurementconverter.h"
1919

2020

21-
QgsLayoutMeasurementConverter::QgsLayoutMeasurementConverter()
22-
: mDpi( 300.0 )
23-
{
24-
}
25-
2621
QgsLayoutMeasurement QgsLayoutMeasurementConverter::convert( const QgsLayoutMeasurement &measurement, const QgsUnitTypes::LayoutUnit targetUnits ) const
2722
{
2823
if ( measurement.units() == targetUnits )

src/core/layout/qgslayoutmeasurementconverter.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ class CORE_EXPORT QgsLayoutMeasurementConverter
4141
{
4242
public:
4343

44-
QgsLayoutMeasurementConverter();
44+
/**
45+
* Constructor for QgsLayoutMeasurementConverter.
46+
*/
47+
QgsLayoutMeasurementConverter() = default;
4548

4649
/**
4750
* Sets the dots per inch (\a dpi) for the measurement converter. This is used
@@ -83,7 +86,7 @@ class CORE_EXPORT QgsLayoutMeasurementConverter
8386

8487
private:
8588

86-
double mDpi;
89+
double mDpi = 300.0;
8790

8891
double convertToMillimeters( const QgsLayoutMeasurement &measurement ) const;
8992
double convertToCentimeters( const QgsLayoutMeasurement &measurement ) const;

src/core/layout/qgslayoutpoint.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ QgsLayoutPoint::QgsLayoutPoint( const double x, const double y, const QgsUnitTyp
2929
}
3030

3131
QgsLayoutPoint::QgsLayoutPoint( const QgsUnitTypes::LayoutUnit units )
32-
: mX( 0.0 )
33-
, mY( 0.0 )
34-
, mUnits( units )
32+
: mUnits( units )
3533
{
3634

3735
}

src/core/layout/qgslayoutpoint.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ class CORE_EXPORT QgsLayoutPoint
151151

152152
private:
153153

154-
double mX;
155-
double mY;
156-
QgsUnitTypes::LayoutUnit mUnits;
154+
double mX = 0.0;
155+
double mY = 0.0;
156+
QgsUnitTypes::LayoutUnit mUnits = QgsUnitTypes::LayoutMillimeters;
157157

158158
};
159159

src/core/layout/qgslayoutsize.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ QgsLayoutSize::QgsLayoutSize( const double width, const double height, const Qgs
2727
}
2828

2929
QgsLayoutSize::QgsLayoutSize( const QgsUnitTypes::LayoutUnit units )
30-
: mWidth( 0.0 )
31-
, mHeight( 0.0 )
32-
, mUnits( units )
30+
: mUnits( units )
3331
{
3432

3533
}

src/core/layout/qgslayoutsize.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ class CORE_EXPORT QgsLayoutSize
155155

156156
private:
157157

158-
double mWidth;
159-
double mHeight;
160-
QgsUnitTypes::LayoutUnit mUnits;
158+
double mWidth = 0.0;
159+
double mHeight = 0.0;
160+
QgsUnitTypes::LayoutUnit mUnits = QgsUnitTypes::LayoutMillimeters;
161161

162162
};
163163

0 commit comments

Comments
 (0)