Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsvghelper_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSVGHELPER_P_H
5#define QSVGHELPER_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qtsvgglobal_p.h"
19
20#include <QRectF>
21
23
24class Q_SVG_EXPORT QSvgRectF : public QRectF
25{
26public:
32 : QRectF(r)
33 , m_unitX(unitX)
34 , m_unitY(unitY)
35 , m_unitW(unitW)
36 , m_unitH(unitH)
37 {}
38
39 QRectF combinedWithLocalRect(const QRectF &localRect) const {
42 result.setX(localRect.x() + x() * localRect.width());
43 else
44 result.setX(x());
46 result.setY(localRect.y() + y() * localRect.height());
47 else
48 result.setY(y());
50 result.setWidth(localRect.width() * width());
51 else
52 result.setWidth(width());
54 result.setHeight(localRect.height() * height());
55 else
56 result.setHeight(height());
57 return result;
58 }
59
62
64 result.setX(x() * boundingBox.width());
65 else
66 result.setX(x());
68 result.setY(y() * boundingBox.height());
69 else
70 result.setY(y());
71 return result;
72 }
73
74 QRectF combinedWithLocalRect(const QRectF &localRect, const QRectF &canvasRect, QtSvg::UnitTypes units) const {
77 result.setX(localRect.x() + x() * localRect.width());
78 else if (m_unitX == QtSvg::UnitTypes::objectBoundingBox)
79 result.setX(localRect.x() + x() * canvasRect.width());
80 else
81 result.setX(x());
83 result.setY(localRect.y() + y() * localRect.height());
84 else if (m_unitY == QtSvg::UnitTypes::objectBoundingBox)
85 result.setY(localRect.y() + y() * canvasRect.height());
86 else
87 result.setY(y());
89 result.setWidth(localRect.width() * width());
90 else if (m_unitW == QtSvg::UnitTypes::objectBoundingBox)
91 result.setWidth(canvasRect.width() * width());
92 else
93 result.setWidth(width());
95 result.setHeight(localRect.height() * height());
96 else if (m_unitH == QtSvg::UnitTypes::objectBoundingBox)
97 result.setHeight(canvasRect.height() * height());
98 else
99 result.setHeight(height());
100
101 return result;
102 }
103
104 QtSvg::UnitTypes unitX() const {return m_unitX;}
105 QtSvg::UnitTypes unitY() const {return m_unitY;}
106 QtSvg::UnitTypes unitW() const {return m_unitW;}
107 QtSvg::UnitTypes unitH() const {return m_unitH;}
108
109 void setUnitX(QtSvg::UnitTypes unit) {m_unitX = unit;}
110 void setUnitY(QtSvg::UnitTypes unit) {m_unitY = unit;}
111 void setUnitW(QtSvg::UnitTypes unit) {m_unitW = unit;}
112 void setUnitH(QtSvg::UnitTypes unit) {m_unitH = unit;}
113
114protected:
119};
120
122
123#endif // QSVGHELPER_P_H
\inmodule QtCore\reentrant
Definition qpoint.h:217
constexpr void setX(qreal x) noexcept
Sets the x coordinate of this point to the given finite x coordinate.
Definition qpoint.h:353
\inmodule QtCore\reentrant
Definition qrect.h:484
constexpr qreal height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:732
constexpr qreal width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:729
constexpr void setX(qreal pos) noexcept
Sets the left edge of the rectangle to the given finite x coordinate.
Definition qrect.h:508
QtSvg::UnitTypes unitH() const
QSvgRectF(const QRectF &r=QRectF(), QtSvg::UnitTypes unitX=QtSvg::UnitTypes::userSpaceOnUse, QtSvg::UnitTypes unitY=QtSvg::UnitTypes::userSpaceOnUse, QtSvg::UnitTypes unitW=QtSvg::UnitTypes::userSpaceOnUse, QtSvg::UnitTypes unitH=QtSvg::UnitTypes::userSpaceOnUse)
void setUnitY(QtSvg::UnitTypes unit)
QtSvg::UnitTypes unitX() const
QtSvg::UnitTypes m_unitW
void setUnitX(QtSvg::UnitTypes unit)
QtSvg::UnitTypes m_unitY
QRectF combinedWithLocalRect(const QRectF &localRect) const
QPointF translationRelativeToBoundingBox(const QRectF &boundingBox) const
QtSvg::UnitTypes m_unitH
QtSvg::UnitTypes unitW() const
QRectF combinedWithLocalRect(const QRectF &localRect, const QRectF &canvasRect, QtSvg::UnitTypes units) const
void setUnitH(QtSvg::UnitTypes unit)
QtSvg::UnitTypes m_unitX
QtSvg::UnitTypes unitY() const
void setUnitW(QtSvg::UnitTypes unit)
Combined button and popup list for selecting options.
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLboolean r
[2]
GLint GLsizei width
GLfloat units
GLint y
GLuint64EXT * result
[6]