27 QSvgRectF(
const QRectF &r = QRectF(),
28 QtSvg::UnitTypes unitX = QtSvg::UnitTypes::userSpaceOnUse,
29 QtSvg::UnitTypes unitY = QtSvg::UnitTypes::userSpaceOnUse,
30 QtSvg::UnitTypes unitW = QtSvg::UnitTypes::userSpaceOnUse,
31 QtSvg::UnitTypes unitH = QtSvg::UnitTypes::userSpaceOnUse)
39 QPointF translationRelativeToBoundingBox(
const QRectF &boundingBox)
const {
42 if (m_unitX == QtSvg::UnitTypes::objectBoundingBox)
43 result.setX(x() * boundingBox.width());
46 if (m_unitY == QtSvg::UnitTypes::objectBoundingBox)
47 result.setY(y() * boundingBox.height());
53 QRectF resolveRelativeLengths(
const QRectF &localRect)
const {
55 if (m_unitX == QtSvg::UnitTypes::objectBoundingBox)
56 result.setX(localRect.x() + x() * localRect.width());
59 if (m_unitY == QtSvg::UnitTypes::objectBoundingBox)
60 result.setY(localRect.y() + y() * localRect.height());
63 if (m_unitW == QtSvg::UnitTypes::objectBoundingBox)
64 result.setWidth(localRect.width() * width());
66 result.setWidth(width());
67 if (m_unitH == QtSvg::UnitTypes::objectBoundingBox)
68 result.setHeight(localRect.height() * height());
70 result.setHeight(height());
74 QRectF resolveRelativeLengths(
const QRectF &localRect, QtSvg::UnitTypes units)
const {
76 if (units == QtSvg::UnitTypes::objectBoundingBox ||
77 m_unitX == QtSvg::UnitTypes::objectBoundingBox)
78 result.setX(localRect.x() + x() * localRect.width());
81 if (units == QtSvg::UnitTypes::objectBoundingBox ||
82 m_unitY == QtSvg::UnitTypes::objectBoundingBox)
83 result.setY(localRect.y() + y() * localRect.height());
86 if (units == QtSvg::UnitTypes::objectBoundingBox ||
87 m_unitW == QtSvg::UnitTypes::objectBoundingBox)
88 result.setWidth(localRect.width() * width());
90 result.setWidth(width());
91 if (units == QtSvg::UnitTypes::objectBoundingBox ||
92 m_unitH == QtSvg::UnitTypes::objectBoundingBox)
93 result.setHeight(localRect.height() * height());
95 result.setHeight(height());
112 friend QDebug operator<<(QDebug debug,
const QSvgRectF &r)
115 debug.nospace() <<
"QSvgRectF(" << r.x()
116 << (r.unitX() == QtSvg::UnitTypes::unknown ?
"(?)" :
117 (r.unitX() == QtSvg::UnitTypes::objectBoundingBox ?
"(%)" :
""))
119 << (r.unitY() == QtSvg::UnitTypes::unknown ?
"(?)" :
120 (r.unitY() == QtSvg::UnitTypes::objectBoundingBox ?
"(%)" :
""))
122 << (r.unitW() == QtSvg::UnitTypes::unknown ?
"(?)" :
123 (r.unitW() == QtSvg::UnitTypes::objectBoundingBox ?
"(%)" :
""))
125 << (r.unitH() == QtSvg::UnitTypes::unknown ?
"(?)" :
126 (r.unitH() == QtSvg::UnitTypes::objectBoundingBox ?
"(%)" :
""))