18#ifndef QGSLAYOUTSIZE_H
19#define QGSLAYOUTSIZE_H
77 Q_ASSERT_X( !std::isnan(
width ) && !std::isnan(
height ),
"QgsLayoutSize",
"Layout size with NaN dimensions created" );
86 double width()
const {
return mWidth; }
97 Q_ASSERT_X( !std::isnan(
width ),
"QgsLayoutSize",
"Layout size with NaN dimensions created" );
106 double height()
const {
return mHeight; }
117 Q_ASSERT_X( !std::isnan(
height ),
"QgsLayoutSize",
"Layout size with NaN dimensions created" );
139 bool isEmpty()
const;
146 QSizeF toQSizeF()
const;
152 QString encodeSize()
const;
184 SIP_PYOBJECT __repr__();
186 QString str = QStringLiteral(
"<QgsLayoutSize: %1 x %2 %3 >" ).arg( sipCpp->width() ).arg( sipCpp->height() ).arg(
QgsUnitTypes::toAbbreviatedString( sipCpp->units() ) );
187 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
194 double mHeight = 0.0;
LayoutUnit
Layout measurement units.
@ Millimeters
Millimeters.
Provides a method of storing sizes, consisting of a width and height, for use in QGIS layouts.
void setUnits(const Qgis::LayoutUnit units)
Sets the units for the size.
void setSize(const double width, const double height)
Sets new width and height for the size.
double height() const
Returns the height of the size.
void setWidth(const double width)
Sets the width for the size.
Qgis::LayoutUnit units() const
Returns the units for the size.
double width() const
Returns the width of the size.
void setHeight(const double height)
Sets the height for the size.
QgsLayoutSize(double width, double height, Qgis::LayoutUnit units=Qgis::LayoutUnit::Millimeters)
Constructor for QgsLayoutSize.
static Q_INVOKABLE QString toAbbreviatedString(Qgis::DistanceUnit unit)
Returns a translated abbreviation representing a distance unit.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
QgsMargins operator*(const QgsMargins &margins, double factor)
Returns a QgsMargins object that is formed by multiplying each component of the given margins by fact...
QgsMargins operator/(const QgsMargins &margins, double divisor)
Returns a QgsMargins object that is formed by dividing the components of the given margins by the giv...